diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-06-10 16:00:33 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-06-10 16:50:18 +0300 |
commit | 9130995df6d2c6461042f3470499b933c10e0211 (patch) | |
tree | 37385293c35349490468d1ed435761c673ec6180 /lib | |
parent | b0885bd0f20362bd2a30f59659ce1b61735b074d (diff) | |
download | rpm-9130995df6d2c6461042f3470499b933c10e0211.tar.gz rpm-9130995df6d2c6461042f3470499b933c10e0211.tar.bz2 rpm-9130995df6d2c6461042f3470499b933c10e0211.zip |
Minimally convert rpmfiBuildFNames() to new headerGet()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tagexts.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/tagexts.c b/lib/tagexts.c index f0e437e2a..e3dadbfe4 100644 --- a/lib/tagexts.c +++ b/lib/tagexts.c @@ -42,19 +42,15 @@ void *rpmHeaderTagFunc(rpmTag tag); static void rpmfiBuildFNames(Header h, rpmTag tagN, const char *** fnp, rpm_count_t * fcp) { - HGE_t hge = (HGE_t)headerGetEntryMinMemory; - HFD_t hfd = headerFreeData; - const char ** baseNames; - const char ** dirNames; - uint32_t * dirIndexes; + const char **baseNames, **dirNames, **fileNames; + uint32_t *dirIndexes; rpm_count_t count; - const char ** fileNames; - int size; + size_t size; rpmTag dirNameTag = 0; rpmTag dirIndexesTag = 0; - rpmTagType bnt, dnt; char * t; - int i, xx; + int i; + struct rpmtd_s bnames, dnames, dixs; if (tagN == RPMTAG_BASENAMES) { dirNameTag = RPMTAG_DIRNAMES; @@ -64,15 +60,24 @@ static void rpmfiBuildFNames(Header h, rpmTag tagN, dirIndexesTag = RPMTAG_ORIGDIRINDEXES; } - if (!hge(h, tagN, &bnt, (rpm_data_t *) &baseNames, &count)) { + if (!headerGet(h, tagN, &bnames, HEADERGET_MINMEM)) { *fnp = NULL; *fcp = 0; return; /* no file list */ } - - xx = hge(h, dirNameTag, &dnt, (rpm_data_t *) &dirNames, NULL); - xx = hge(h, dirIndexesTag, NULL, (rpm_data_t *) &dirIndexes, &count); - + (void) headerGet(h, dirNameTag, &dnames, HEADERGET_MINMEM); + (void) headerGet(h, dirIndexesTag, &dixs, HEADERGET_MINMEM); + + count = rpmtdCount(&bnames); + baseNames = bnames.data; + dirNames = dnames.data; + dirIndexes = dixs.data; + + /* + * fsm, psm and rpmfi assume the data is stored in a single allocation + * block, until those assumptions are removed we need to jump through + * a few hoops here and precalculate sizes etc + */ size = sizeof(*fileNames) * count; for (i = 0; i < count; i++) size += strlen(baseNames[i]) + strlen(dirNames[dirIndexes[i]]) + 1; @@ -84,12 +89,14 @@ static void rpmfiBuildFNames(Header h, rpmTag tagN, t = stpcpy( stpcpy(t, dirNames[dirIndexes[i]]), baseNames[i]); *t++ = '\0'; } - baseNames = hfd(baseNames, bnt); - dirNames = hfd(dirNames, dnt); + rpmtdFreeData(&bnames); + rpmtdFreeData(&dnames); + rpmtdFreeData(&dixs); *fnp = fileNames; *fcp = count; } + static int filedepTag(Header h, rpmTag tagN, rpmtd td) { int scareMem = 0; |