summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2017-04-04 15:11:39 +0300
committerPanu Matilainen <pmatilai@redhat.com>2017-04-04 15:11:39 +0300
commit62347e4049a2f2e875501d9b2493ac8c6feb4c75 (patch)
tree58aebf2b1af4b03454a052a792e437a01be3662e
parent7672ce08685b41470673cf1ca8678f47ff7a59ed (diff)
downloadrpm-62347e4049a2f2e875501d9b2493ac8c6feb4c75.tar.gz
Use separate locally scoped variables for different tasks
Makes it easier to see that there are no hidden side-effects etc involved when the variable is truly block local and not function wide.
-rw-r--r--lib/rpmfi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index e5a1114a5..427557b78 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1419,7 +1419,6 @@ static int rpmfilesPopulate(rpmfiles fi, Header h, rpmfiFlags flags)
HEADERGET_MINMEM : HEADERGET_ALLOC;
headerGetFlags defFlags = HEADERGET_ALLOC;
struct rpmtd_s fdigests, fsignatures, digalgo, td;
- unsigned char * t;
rpm_count_t totalfc = rpmfilesFC(fi);
/* XXX TODO: all these should be sanity checked, ugh... */
@@ -1478,7 +1477,7 @@ static int rpmfilesPopulate(rpmfiles fi, Header h, rpmfiFlags flags)
if (rpmtdCount(&fdigests) != totalfc)
goto err;
size_t diglen = rpmDigestLength(fi->digestalgo);
- fi->digests = t = xmalloc(rpmtdCount(&fdigests) * diglen);
+ uint8_t *t = fi->digests = xmalloc(rpmtdCount(&fdigests) * diglen);
while ((fdigest = rpmtdNextString(&fdigests))) {
if (!(fdigest && *fdigest != '\0')) {
@@ -1499,7 +1498,7 @@ static int rpmfilesPopulate(rpmfiles fi, Header h, rpmfiFlags flags)
const char *fsignature;
if (rpmtdCount(&fsignatures) != totalfc)
goto err;
- fi->signatures = t = xmalloc(rpmtdCount(&fsignatures) * fi->signaturelength);
+ uint8_t *t = fi->signatures = xmalloc(rpmtdCount(&fsignatures) * fi->signaturelength);
fi->signaturelength = headerGetNumber(h, RPMTAG_FILESIGNATURELENGTH);
while ((fsignature = rpmtdNextString(&fsignatures))) {