diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-13 08:48:56 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-13 09:01:30 +0300 |
commit | 1e2c2fece25adad725261089ca47108937067088 (patch) | |
tree | d9b3a035c768228a7d50f2490e207845294ebd45 /rpmio/rpmstrpool.c | |
parent | b6c794362aa9b3b2552f32bd13775a127febc17d (diff) | |
download | librpm-tizen-1e2c2fece25adad725261089ca47108937067088.tar.gz librpm-tizen-1e2c2fece25adad725261089ca47108937067088.tar.bz2 librpm-tizen-1e2c2fece25adad725261089ca47108937067088.zip |
Add a string equality check function to string pool API
- As a special case, two strings (ids) from the same pool can be tested for
equality in constant time (integer comparison). If the pools differ,
a regular string comparison is needed.
Diffstat (limited to 'rpmio/rpmstrpool.c')
-rw-r--r-- | rpmio/rpmstrpool.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rpmio/rpmstrpool.c b/rpmio/rpmstrpool.c index 55fc0e0bd..799136b01 100644 --- a/rpmio/rpmstrpool.c +++ b/rpmio/rpmstrpool.c @@ -173,3 +173,12 @@ size_t rpmstrPoolStrlen(rpmstrPool pool, rpmsid sid) } return slen; } + +int rpmstrPoolStreq(rpmstrPool poolA, rpmsid sidA, + rpmstrPool poolB, rpmsid sidB) +{ + if (poolA == poolB) + return (sidA == sidB); + else + return rstreq(rpmstrPoolStr(poolA, sidA), rpmstrPoolStr(poolB, sidB)); +} |