teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/0001-When-doing-the-same-thing-more-than-once-use-a-loop.patch

787856
From 9cbc1fe444b048c3f7cf5ea09ab650d1c146d54a Mon Sep 17 00:00:00 2001
787856
From: Panu Matilainen <pmatilai@redhat.com>
787856
Date: Wed, 20 Feb 2019 14:49:19 +0200
787856
Subject: [PATCH] When doing the same thing more than once, use a loop...
787856
787856
No functional changes but this'll simplify the next commit quite a bit.
787856
---
787856
 build/spec.c | 12 +++++-------
787856
 1 file changed, 5 insertions(+), 7 deletions(-)
787856
787856
diff --git a/build/spec.c b/build/spec.c
787856
index e414e4102..80eaca611 100644
787856
--- a/build/spec.c
787856
+++ b/build/spec.c
787856
@@ -303,15 +303,13 @@ rpmSpec newSpec(void)
787856
     spec->pool = rpmstrPoolCreate();
787856
     
787856
 #ifdef WITH_LUA
787856
-    {
787856
     /* make sure patches and sources tables always exist */
787856
     rpmlua lua = NULL; /* global state */
787856
-    rpmluaDelVar(lua, "patches");
787856
-    rpmluaDelVar(lua, "sources");
787856
-    rpmluaPushTable(lua, "patches");
787856
-    rpmluaPushTable(lua, "sources");
787856
-    rpmluaPop(lua);
787856
-    rpmluaPop(lua);
787856
+    const char * luavars[] = { "patches", "sources", NULL, };
787856
+    for (const char **vp = luavars; vp && *vp; vp++) {
787856
+	rpmluaDelVar(lua, *vp);
787856
+	rpmluaPushTable(lua, *vp);
787856
+	rpmluaPop(lua);
787856
     }
787856
 #endif
787856
     return spec;
787856
-- 
787856
2.26.2
787856