From 8feed8b3ae00ecf86b4321071ec27c907526d10c Mon Sep 17 00:00:00 2001 From: Packit Service Date: Feb 02 2021 06:18:11 +0000 Subject: Apply patch 0001-When-doing-the-same-thing-more-than-once-use-a-loop.patch patch_name: 0001-When-doing-the-same-thing-more-than-once-use-a-loop.patch present_in_specfile: true location_in_specfile: 29 --- diff --git a/build/spec.c b/build/spec.c index a9808ba..2ea1cfd 100644 --- a/build/spec.c +++ b/build/spec.c @@ -251,15 +251,13 @@ rpmSpec newSpec(void) spec->pool = rpmstrPoolCreate(); #ifdef WITH_LUA - { /* make sure patches and sources tables always exist */ rpmlua lua = NULL; /* global state */ - rpmluaDelVar(lua, "patches"); - rpmluaDelVar(lua, "sources"); - rpmluaPushTable(lua, "patches"); - rpmluaPushTable(lua, "sources"); - rpmluaPop(lua); - rpmluaPop(lua); + const char * luavars[] = { "patches", "sources", NULL, }; + for (const char **vp = luavars; vp && *vp; vp++) { + rpmluaDelVar(lua, *vp); + rpmluaPushTable(lua, *vp); + rpmluaPop(lua); } #endif return spec;