summaryrefslogtreecommitdiff
path: root/lib/psm.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-14 19:32:51 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-14 19:32:51 +0300
commita2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48 (patch)
treeb758f51358e5786eefd73ba80c49c63680c62ef3 /lib/psm.c
parent180a34737203f0cc1e0d843915387ce9ffeb894c (diff)
downloadrpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.tar.gz
rpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.tar.bz2
rpm-a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48.zip
Avoid unnecessary rpmio_flags alloc+free in psm
Diffstat (limited to 'lib/psm.c')
-rw-r--r--lib/psm.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/psm.c b/lib/psm.c
index b8f52c194..70f0c2a9e 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -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;