From: Jindrich Novy Date: Wed, 9 Apr 2008 11:05:45 +0000 (+0200) Subject: Don't use stack allocations in rpm2cpio when not needed X-Git-Tag: tznext/4.11.0.1.tizen20130304~4425 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61b008b5662652ac8ea05ea76611b73efe9cf656;p=tools%2Flibrpm-tizen.git Don't use stack allocations in rpm2cpio when not needed --- diff --git a/rpm2cpio.c b/rpm2cpio.c index b18133d..05ff8e9 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -66,17 +66,14 @@ int main(int argc, char *argv[]) /* Retrieve type of payload compression. */ { const char * payload_compressor = NULL; - char * t; if (!headerGetEntry(h, RPMTAG_PAYLOADCOMPRESSOR, NULL, (rpm_data_t *) &payload_compressor, NULL)) payload_compressor = "gzip"; - rpmio_flags = t = alloca(sizeof("r.gzdio")); - *t++ = 'r'; if (!strcmp(payload_compressor, "gzip")) - t = stpcpy(t, ".gzdio"); + rpmio_flags = "r.gzdio"; if (!strcmp(payload_compressor, "bzip2")) - t = stpcpy(t, ".bzdio"); + rpmio_flags = "r.bzdio"; } gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */