summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-07 21:13:21 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-07 21:13:21 +0300
commit068b2afdf674e424c24ffed86486c5c5e1522d0a (patch)
treee3803bac9a662423546498887545366e66576066
parentf0a9d2577b782e6f1222626877076946764df657 (diff)
downloadlibrpm-tizen-068b2afdf674e424c24ffed86486c5c5e1522d0a.tar.gz
librpm-tizen-068b2afdf674e424c24ffed86486c5c5e1522d0a.tar.bz2
librpm-tizen-068b2afdf674e424c24ffed86486c5c5e1522d0a.zip
Split the tagdata -> pool population to another helper function
- For filename triplets we'll need to get and validate the data before inserting into the pool, so we'll need this shortly.
-rw-r--r--lib/rpmfi.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 678612152..68cb52e71 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1063,19 +1063,23 @@ rpmfi rpmfiFree(rpmfi fi)
return NULL;
}
+static rpmsid * td2pool(rpmstrPool pool, rpmtd td)
+{
+ rpmsid *sids = xmalloc(sizeof(*sids) * rpmtdCount(td));
+ const char *str;
+ int i = 0;
+ while ((str = rpmtdNextString(td)))
+ sids[i++] = rpmstrPoolId(pool, str, 1);
+ return sids;
+}
+
static rpmsid * tag2pool(rpmstrPool pool, Header h, rpmTag tag)
{
rpmsid *sids = NULL;
struct rpmtd_s td;
if (headerGet(h, tag, &td, HEADERGET_MINMEM)) {
- int i = 0;
- const char *str;
-
- sids = xmalloc(sizeof(*sids) * rpmtdCount(&td));
- while ((str = rpmtdNextString(&td))) {
- sids[i++] = rpmstrPoolId(pool, str, 1);
- }
- rpmtdFreeData(&td);
+ sids = td2pool(pool, &td);
+ rpmtdFreeData(&td);
}
return sids;
}