summaryrefslogtreecommitdiff
path: root/lib/tagexts.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-26 12:40:43 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-26 12:40:43 +0300
commit77c25969a97cc3fc31e7c8bdbc27a99481ae828a (patch)
tree32c2db7b193e687f773694a24e7163e67ac48125 /lib/tagexts.c
parentefe1665024e374a8f8704d229b1d306af232c396 (diff)
downloadlibrpm-tizen-77c25969a97cc3fc31e7c8bdbc27a99481ae828a.tar.gz
librpm-tizen-77c25969a97cc3fc31e7c8bdbc27a99481ae828a.tar.bz2
librpm-tizen-77c25969a97cc3fc31e7c8bdbc27a99481ae828a.zip
Convert triggertypeTag() to new headerGet()
Diffstat (limited to 'lib/tagexts.c')
-rw-r--r--lib/tagexts.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/tagexts.c b/lib/tagexts.c
index 1e1740809..7575ce46c 100644
--- a/lib/tagexts.c
+++ b/lib/tagexts.c
@@ -247,47 +247,47 @@ static int triggercondsTag(Header h, rpmtd td)
*/
static int triggertypeTag(Header h, rpmtd td)
{
- HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- HFD_t hfd = headerFreeData;
- rpmTagType tst;
- int32_t * indices;
- const char ** conds;
- const char ** s;
- int xx;
- rpm_count_t numScripts, numNames;
- rpm_count_t i, j;
- rpm_flag_t * flags;
-
- if (!hge(h, RPMTAG_TRIGGERINDEX, NULL, (rpm_data_t *) &indices, &numNames)) {
+ int i;
+ char ** conds;
+ struct rpmtd_s indices, flags, scripts;
+
+ if (!headerGet(h, RPMTAG_TRIGGERINDEX, &indices, HEADERGET_MINMEM)) {
return 1;
}
- xx = hge(h, RPMTAG_TRIGGERFLAGS, NULL, (rpm_data_t *) &flags, NULL);
- xx = hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (rpm_data_t *) &s, &numScripts);
- s = hfd(s, tst);
+ headerGet(h, RPMTAG_TRIGGERFLAGS, &flags, HEADERGET_MINMEM);
+ headerGet(h, RPMTAG_TRIGGERSCRIPTS, &scripts, HEADERGET_MINMEM);
td->flags = RPMTD_ALLOCED | RPMTD_PTR_ALLOCED;
- td->data = conds = xmalloc(sizeof(*conds) * numScripts);
- td->count = numScripts;
+ td->count = rpmtdCount(&scripts);
+ td->data = conds = xmalloc(sizeof(*conds) * td->count);
td->type = RPM_STRING_ARRAY_TYPE;
- for (i = 0; i < numScripts; i++) {
- for (j = 0; j < numNames; j++) {
- if (indices[j] != i)
+
+ while ((i = rpmtdNext(&scripts)) >= 0) {
+ rpm_flag_t *flag;
+ rpmtdInit(&indices); rpmtdInit(&flags);
+
+ while (rpmtdNext(&indices) >= 0 && rpmtdNext(&flags) >= 0) {
+ if (*rpmtdGetUint32(&indices) != i)
continue;
- if (flags[j] & RPMSENSE_TRIGGERPREIN)
+ flag = rpmtdGetUint32(&flags);
+ if (*flag & RPMSENSE_TRIGGERPREIN)
conds[i] = xstrdup("prein");
- else if (flags[j] & RPMSENSE_TRIGGERIN)
+ else if (*flag & RPMSENSE_TRIGGERIN)
conds[i] = xstrdup("in");
- else if (flags[j] & RPMSENSE_TRIGGERUN)
+ else if (*flag & RPMSENSE_TRIGGERUN)
conds[i] = xstrdup("un");
- else if (flags[j] & RPMSENSE_TRIGGERPOSTUN)
+ else if (*flag & RPMSENSE_TRIGGERPOSTUN)
conds[i] = xstrdup("postun");
else
conds[i] = xstrdup("");
break;
}
}
+ rpmtdFreeData(&indices);
+ rpmtdFreeData(&flags);
+ rpmtdFreeData(&scripts);
return 0;
}