Don't bother calculating string sizes manually
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 9 Jan 2009 15:05:40 +0000 (17:05 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 9 Jan 2009 15:07:17 +0000 (17:07 +0200)
- ...and one less strcpy() to grep for

build/files.c

index bd55a41..1f5212e 100644 (file)
@@ -2088,11 +2088,9 @@ int processSourceFiles(rpmSpec spec)
     /* Init the file list structure */
     memset(&fl, 0, sizeof(fl));
     if (_srcdefattr) {
-       char *a = xmalloc(strlen(_srcdefattr) + 9 + 1);
-       strcpy(a, "%defattr ");
-       strcpy(a + 9, _srcdefattr);
+       char *a = rstrscat(NULL, "%defattr ", _srcdefattr, NULL);
        parseForAttr(a, &fl);
-       a = _free(a);
+       free(a);
     }
     fl.fileList = xcalloc((spec->numSources + 1), sizeof(*fl.fileList));
     fl.processingFailed = 0;