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