diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-14 19:32:51 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-14 19:32:51 +0300 |
commit | a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48 (patch) | |
tree | b758f51358e5786eefd73ba80c49c63680c62ef3 | |
parent | 180a34737203f0cc1e0d843915387ce9ffeb894c (diff) | |
download | rpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.tar.gz rpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.tar.bz2 rpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.zip |
Avoid unnecessary rpmio_flags alloc+free in psm
-rw-r--r-- | lib/psm.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -43,7 +43,7 @@ struct rpmpsm_s { FD_t cfd; /*!< Payload file handle. */ rpmdbMatchIterator mi; const char * stepName; - char * rpmio_flags; + const char * rpmio_flags; char * failedFile; int scriptTag; /*!< Scriptlet data tag. */ int progTag; /*!< Scriptlet interpreter tag. */ @@ -1632,7 +1632,6 @@ assert(psm->mi == NULL); if (fi->h != NULL) fi->h = headerFree(fi->h); } - psm->rpmio_flags = _free(psm->rpmio_flags); psm->failedFile = _free(psm->failedFile); fi->fgroup = hfd(fi->fgroup, RPM_FORCEFREE_TYPE); @@ -1728,18 +1727,15 @@ assert(psm->mi == NULL); case PSM_RPMIO_FLAGS: { const char * payload_compressor = NULL; - char * t; if (!hge(fi->h, RPMTAG_PAYLOADCOMPRESSOR, NULL, (rpm_data_t *) &payload_compressor, NULL)) payload_compressor = "gzip"; - psm->rpmio_flags = t = xmalloc(sizeof("w9.gzdio")); - *t = '\0'; - t = stpcpy(t, "r"); if (!strcmp(payload_compressor, "gzip")) - t = stpcpy(t, ".gzdio"); + psm->rpmio_flags = "r.gzdio"; if (!strcmp(payload_compressor, "bzip2")) - t = stpcpy(t, ".bzdio"); + psm->rpmio_flags = "r.bzdio"; + rc = RPMRC_OK; } break; |