Avoid entirely unnecessary static buffer + string copy.
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 31 Mar 2008 14:06:47 +0000 (17:06 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 31 Mar 2008 14:06:47 +0000 (17:06 +0300)
lib/depends.c

index 04db1e2..afc57dc 100644 (file)
@@ -1345,7 +1345,7 @@ rescan:
            /* T13. Print predecessor chain from start of loop. */
            while ((p = q) != NULL && (q = rpmteTSI(p)->tsi_chain) != NULL) {
                char * dp;
-               char buf[4096];
+               const char *nevra;
                int msglvl = (rpmtsFlags(ts) & RPMTRANS_FLAG_DEPLOOPS)
                        ? RPMLOG_WARNING : RPMLOG_DEBUG;
 ;
@@ -1366,10 +1366,8 @@ rescan:
                dp = zapRelation(q, p, requires, 1, &nzaps, msglvl);
 
                /* Print next member of loop. */
-               buf[0] = '\0';
-               if (rpmteNEVRA(p) != NULL)
-                   (void) stpcpy(buf, rpmteNEVRA(p));
-               rpmlog(msglvl, "    %-40s %s\n", buf,
+               nevra = rpmteNEVRA(p);
+               rpmlog(msglvl, "    %-40s %s\n", (nevra ? nevra : "???"),
                        (dp ? dp : "not found!?!"));
 
                dp = _free(dp);