diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-29 14:40:40 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-29 14:40:40 +0300 |
commit | 6ba22ca0d9f9de9ee358111f457bdbe323e263b9 (patch) | |
tree | c2ef7f6ffed146df82f7877cacc1dfe59df83f7f /build | |
parent | 343d3a2cf7a3ad70ab0e056a156b03c4b1212c0b (diff) | |
download | librpm-tizen-6ba22ca0d9f9de9ee358111f457bdbe323e263b9.tar.gz librpm-tizen-6ba22ca0d9f9de9ee358111f457bdbe323e263b9.tar.bz2 librpm-tizen-6ba22ca0d9f9de9ee358111f457bdbe323e263b9.zip |
headerNextTag() fits the checkForDuplicates() use-case better
- as we're only looking at tags, not their contents... avoid unnecessary
data shuffling and the code is a little simpler too
Diffstat (limited to 'build')
-rw-r--r-- | build/parsePreamble.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 1a0e79dcd..a4a875040 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -274,20 +274,16 @@ static int checkForRequired(Header h, const char * NVR) static int checkForDuplicates(Header h, const char * NVR) { int res = RPMRC_OK; - rpmTag lastTag, tag; - HeaderIterator hi; - struct rpmtd_s td; - - for (hi = headerInitIterator(h), lastTag = 0; - headerNext(hi, &td), tag = rpmtdTag(&td); - lastTag = tag) - { + rpmTag tag, lastTag = RPMTAG_NOT_FOUND; + HeaderIterator hi = headerInitIterator(h); + + while ((tag = headerNextTag(hi)) != RPMTAG_NOT_FOUND) { if (tag == lastTag) { rpmlog(RPMLOG_ERR, _("Duplicate %s entries in package: %s\n"), rpmTagGetName(tag), NVR); res = RPMRC_FAIL; } - rpmtdFreeData(&td); + lastTag = tag; } hi = headerFreeIterator(hi); |