From 1d83ec55d654c46ef428a5ec49de160bb51f872b Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 4 Nov 2020 11:16:39 +0200 Subject: [PATCH] Lose now unnecessary chkexist and negate arguments to builtin macros No functional changes. --- rpmio/macro.c | 65 +++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/rpmio/macro.c b/rpmio/macro.c index acbba6214..4ee599205 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -133,8 +133,7 @@ static int print_macro_trace = _PRINT_MACRO_TRACE; #define _PRINT_EXPAND_TRACE 0 static int print_expand_trace = _PRINT_EXPAND_TRACE; -typedef void (*macroFunc)(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); +typedef void (*macroFunc)(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); typedef const char *(*parseFunc)(MacroBuf mb, rpmMacroEntry me, const char * se); /* forward ref */ @@ -143,26 +142,16 @@ static void pushMacro(rpmMacroContext mc, const char * n, const char * o, const char * b, int level, int flags); static void popMacro(rpmMacroContext mc, const char * n); static int loadMacroFile(rpmMacroContext mc, const char * fn); -static void doBody(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doExpand(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doFoo(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doLoad(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doLua(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doOutput(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doSP(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doTrace(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doUncompress(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); -static void doVerbose(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn); +static void doBody(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doExpand(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doFoo(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doLoad(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doLua(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doOutput(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doSP(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doTrace(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doUncompress(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); +static void doVerbose(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn); static const char * doDef(MacroBuf mb, rpmMacroEntry me, const char * se); static const char * doGlobal(MacroBuf mb, rpmMacroEntry me, const char * se); @@ -1034,8 +1023,7 @@ grabArgs(MacroBuf mb, ARGV_t *argvp, const char * se, lastc : lastc + 1; } -static void doBody(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doBody(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { if (gn > 0) { char *buf = NULL; @@ -1051,7 +1039,7 @@ static void doBody(MacroBuf mb, int chkexist, int negate, } } -static void doOutput(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, const char * g, size_t gn) +static void doOutput(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { char *buf = NULL; int loglevel = RPMLOG_NOTICE; /* assume echo */ @@ -1069,7 +1057,7 @@ static void doOutput(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, co _free(buf); } -static void doLua(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, const char * g, size_t gn) +static void doLua(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { #ifdef WITH_LUA rpmlua lua = NULL; /* Global state. */ @@ -1112,8 +1100,7 @@ static void doLua(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, const } static void -doSP(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +doSP(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { const char *b = ""; char *buf = NULL; @@ -1130,8 +1117,7 @@ doSP(MacroBuf mb, int chkexist, int negate, free(buf); } -static void doUncompress(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doUncompress(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { rpmCompressedMagic compressed = COMPRESSED_OTHER; char *b, *be, *buf = NULL; @@ -1189,8 +1175,7 @@ exit: free(buf); } -static void doExpand(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doExpand(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { if (gn > 0) { char *buf; @@ -1200,8 +1185,7 @@ static void doExpand(MacroBuf mb, int chkexist, int negate, } } -static void doVerbose(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doVerbose(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { mbAppend(mb, rpmIsVerbose() ? '1' : '0'); } @@ -1209,14 +1193,11 @@ static void doVerbose(MacroBuf mb, int chkexist, int negate, /** * Execute macro primitives. * @param mb macro expansion state - * @param chkexist unused - * @param negate should logic be inverted? * @param g beginning of field g * @param gn length of field g */ static void -doFoo(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, - const char * g, size_t gn) +doFoo(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { char *buf = NULL; char *b = NULL; @@ -1296,8 +1277,7 @@ doFoo(MacroBuf mb, int chkexist, int negate, rpmMacroEntry me, free(buf); } -static void doLoad(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doLoad(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { char *arg = NULL; if (g && gn > 0 && expandThis(mb, g, gn, &arg) == 0) { @@ -1308,8 +1288,7 @@ static void doLoad(MacroBuf mb, int chkexist, int negate, free(arg); } -static void doTrace(MacroBuf mb, int chkexist, int negate, - rpmMacroEntry me, const char * g, size_t gn) +static void doTrace(MacroBuf mb, rpmMacroEntry me, const char * g, size_t gn) { mb->expand_trace = mb->macro_trace = mb->depth; if (mb->depth == 1) { @@ -1542,7 +1521,7 @@ expandMacro(MacroBuf mb, const char *src, size_t slen) s = parse(mb, me, se); } else { macroFunc func = me->func; - func(mb, chkexist, negate, me, g, gn); + func(mb, me, g, gn); s = se; } continue;