parseScript() const pedantry
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 28 Oct 2010 08:47:29 +0000 (11:47 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 28 Oct 2010 08:57:47 +0000 (11:57 +0300)
- The string from getStringBuf() is not modified, so use a const
  variable for it, and a separate variable for the temporary
  line splitting for triggers

build/parseScript.c

index 017b880..d4b2293 100644 (file)
@@ -65,7 +65,7 @@ int parseScript(rpmSpec spec, int parsePart)
     /*  -p "<sh> <args>..."                */
     /*  -f <file>                          */
 
-    char *p;
+    const char *p;
     const char **progArgv = NULL;
     int progArgc;
     const char *partname = NULL;
@@ -187,15 +187,15 @@ int parseScript(rpmSpec spec, int parsePart)
 
     if (tag == RPMTAG_TRIGGERSCRIPTS) {
        /* break line into two */
-       p = strstr(spec->line, "--");
-       if (!p) {
+       char *s = strstr(spec->line, "--");
+       if (!s) {
            rpmlog(RPMLOG_ERR, _("line %d: triggers must have --: %s\n"),
                     spec->lineNum, spec->line);
            return PART_ERROR;
        }
 
-       *p = '\0';
-       reqargs = xstrdup(p + 2);
+       *s = '\0';
+       reqargs = xstrdup(s + 2);
     }
     
     if ((rc = poptParseArgvString(spec->line, &argc, &argv))) {