diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-05-21 14:49:12 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-05-21 14:49:12 +0300 |
commit | 35c0252857822faac53b7df9c9632d21bed926d5 (patch) | |
tree | a52feeeefd03cafb14e1762e55b786c3efa5a123 /lib/rpmtd.c | |
parent | 3d8656f040d2c780c88d0cd63594898f0605a6fa (diff) | |
download | librpm-tizen-35c0252857822faac53b7df9c9632d21bed926d5.tar.gz librpm-tizen-35c0252857822faac53b7df9c9632d21bed926d5.tar.bz2 librpm-tizen-35c0252857822faac53b7df9c9632d21bed926d5.zip |
Add per-datatype iterators to rpmtd
- just uint32 and string iterators for now, those are the most common ones
- allows somewhat more convenient code constructs when type is known,
eg no need to separately check for non-null inside loops
Diffstat (limited to 'lib/rpmtd.c')
-rw-r--r-- | lib/rpmtd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/rpmtd.c b/lib/rpmtd.c index d1c49cf33..daac14542 100644 --- a/lib/rpmtd.c +++ b/lib/rpmtd.c @@ -96,6 +96,26 @@ int rpmtdNext(rpmtd td) return i; } +uint32_t *rpmtdNextUint32(rpmtd td) +{ + assert(td != NULL); + uint32_t *res = NULL; + if (rpmtdNext(td) >= 0) { + res = rpmtdGetUint32(td); + } + return res; +} + +const char *rpmtdNextString(rpmtd td) +{ + assert(td != NULL); + const char *res = NULL; + if (rpmtdNext(td) >= 0) { + res = rpmtdGetString(td); + } + return res; +} + char * rpmtdGetChar(rpmtd td) { char *res = NULL; |