Use POPT_BIT_SET for setting the scriptlet flags
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Sep 2011 10:26:42 +0000 (13:26 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 12 Sep 2011 10:27:12 +0000 (13:27 +0300)
- No functional changes, just avoid doing extra work for what popt
  can already do for us.

build/parseScript.c

index ed1568d..1a149e1 100644 (file)
@@ -90,14 +90,14 @@ int parseScript(rpmSpec spec, int parsePart)
     const char *name = NULL;
     const char *prog = "/bin/sh";
     const char *file = NULL;
-    int expand = 0;
-    int qformat = 0;
     struct poptOption optionsTable[] = {
        { NULL, 'p', POPT_ARG_STRING, &prog, 'p',       NULL, NULL},
        { NULL, 'n', POPT_ARG_STRING, &name, 'n',       NULL, NULL},
        { NULL, 'f', POPT_ARG_STRING, &file, 'f',       NULL, NULL},
-       { NULL, 'e', POPT_ARG_NONE, &expand, 'e',       NULL, NULL},
-       { NULL, 'q', POPT_ARG_NONE, &qformat, 'q',      NULL, NULL},
+       { NULL, 'e', POPT_BIT_SET, &scriptFlags, RPMSCRIPT_FLAG_EXPAND,
+         NULL, NULL},
+       { NULL, 'q', POPT_BIT_SET, &scriptFlags, RPMSCRIPT_FLAG_QFORMAT,
+         NULL, NULL},
        { 0, 0, 0, 0, 0,        NULL, NULL}
     };
 
@@ -267,9 +267,6 @@ int parseScript(rpmSpec spec, int parsePart)
        goto exit;
     }
 
-    scriptFlags |= expand ? RPMSCRIPT_FLAG_EXPAND : 0;
-    scriptFlags |= qformat ? RPMSCRIPT_FLAG_QFORMAT : 0;
-
     sb = newStringBuf();
     if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
        nextPart = PART_NONE;