summaryrefslogtreecommitdiff
path: root/lib/query.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-04-07 14:04:00 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-04-07 14:04:00 +0300
commit5ef8b53108f41220602febbd2e10f3b76ab32b82 (patch)
treee87fe0e88f7004114cd3156b3221ece87d077c14 /lib/query.c
parenta41079c692aa75e5e995aaf1e5c355edad5552d9 (diff)
downloadlibrpm-tizen-5ef8b53108f41220602febbd2e10f3b76ab32b82.tar.gz
librpm-tizen-5ef8b53108f41220602febbd2e10f3b76ab32b82.tar.bz2
librpm-tizen-5ef8b53108f41220602febbd2e10f3b76ab32b82.zip
Eliminate several copy-paste hex converters, use pgpHexStr() instead
Diffstat (limited to 'lib/query.c')
-rw-r--r--lib/query.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/query.c b/lib/query.c
index 2ef0a3a78..20068af69 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -186,7 +186,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
rpmfileState fstate;
rpm_off_t fsize;
const char * fn;
- char fmd5[32+1];
+ char *fmd5;
const char * fuser;
const char * fgroup;
const char * flink;
@@ -199,17 +199,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
fstate = rpmfiFState(fi);
fsize = rpmfiFSize(fi);
fn = rpmfiFN(fi);
- { static char const hex[] = "0123456789abcdef";
- unsigned const char * s = rpmfiMD5(fi);
- char * p = fmd5;
- int j;
- for (j = 0; j < 16; j++) {
- unsigned k = *s++;
- *p++ = hex[ (k >> 4) & 0xf ];
- *p++ = hex[ (k ) & 0xf ];
- }
- *p = '\0';
- }
+ fmd5 = pgpHexStr(rpmfiMD5(fi), rpmDigestLength(PGPHASHALGO_MD5));
fuser = rpmfiFUser(fi);
fgroup = rpmfiFGroup(fi);
flink = rpmfiFLink(fi);
@@ -308,6 +298,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
}
}
flushBuffer(&t, &te, 0);
+ free(fmd5);
}
rc = 0;