1 --- rpm-4.5/rpmio/macro.c 2009-08-08 15:47:20.495455961 +0200
2 +++ rpm-4.5/rpmio/macro.c 2012-11-08 06:37:45.082618600 +0200
7 +void delMacroAll(MacroContext mc, const char * n);
9 + * Parse (and execute) macro undefinition.
10 + * @param mc macro context
11 + * @param se macro name to undefine
12 + * @return address to continue parsing
14 +/*@dependent@*/ static const char *
15 +doUnglobal(MacroContext mc, /*@returned@*/ const char * se)
16 + /*@globals rpmGlobalMacroContext @*/
17 + /*@modifies mc, rpmGlobalMacroContext @*/
20 + char *buf = alloca(_macro_BUFSIZ);
21 + char *n = buf, *ne = n;
26 + /* Move scan over body */
31 + /* Names must start with alphabetic or _ and be at least 3 chars */
32 + if (!((c = *n) && (xisalpha(c) || c == '_') && (ne - n) > 2)) {
33 + rpmError(RPMERR_BADSPEC,
34 + _("Macro %%%s has illegal name (%%unglobal)\n"), n);
45 dumpME(const char * msg, MacroEntry me)
46 @@ -1430,6 +1466,10 @@
47 s = doUndefine(mb->mc, se);
50 + if (STREQ("unglobal", f, fn)) {
51 + s = doUnglobal(mb->mc, se);
55 if (STREQ("echo", f, fn) ||
56 STREQ("warn", f, fn) ||
57 @@ -1984,6 +2024,18 @@
62 +delMacroAll(MacroContext mc, const char * n)
66 + if (mc == NULL) mc = rpmGlobalMacroContext;
67 + /* If name exists, pop entry */
68 + while ((mep = findEntry(mc, n, 0)) != NULL) {
73 /*@-mustmod@*/ /* LCL: mc is modified through mb->mc, mb is abstract */
75 rpmDefineMacro(MacroContext mc, const char * macro, int level)