summaryrefslogtreecommitdiff
path: root/rpmio/rpmstring.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-18 04:34:38 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-18 04:40:20 +0300
commit76a699701cda144af96f77061b036c7afc10fce4 (patch)
tree661eb71c16f5d13e34b025d280ab95a3d9ae7b3c /rpmio/rpmstring.c
parentbef4be688de3b29fe62d10bf723ad888111853aa (diff)
downloadlibrpm-tizen-76a699701cda144af96f77061b036c7afc10fce4.tar.gz
librpm-tizen-76a699701cda144af96f77061b036c7afc10fce4.tar.bz2
librpm-tizen-76a699701cda144af96f77061b036c7afc10fce4.zip
Enhanced string hash to permit calculating string length on the same call
- String hashing needs to walk the entire string anyhow, might as well take advantage of this and have it return the string length to avoid having to separately call strlen() in the cases where this matters. - Move the implementation into rpmstrpool.c for inlining possibilities, rstrhash() is now just a wrapper to rstrlenhash(). The generic hash implementation could not take advantage of this anyway really.
Diffstat (limited to 'rpmio/rpmstring.c')
-rw-r--r--rpmio/rpmstring.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/rpmio/rpmstring.c b/rpmio/rpmstring.c
index d6bc0bf06..0022b6075 100644
--- a/rpmio/rpmstring.c
+++ b/rpmio/rpmstring.c
@@ -190,20 +190,3 @@ size_t rstrlcpy(char *dest, const char *src, size_t n)
return s - src - 1; /* count does not include NUL */
}
-
-unsigned int rstrhash(const char * string)
-{
- /* Jenkins One-at-a-time hash */
- unsigned int hash = 0xe4721b68;
-
- while (*string != '\0') {
- hash += *string;
- hash += (hash << 10);
- hash ^= (hash >> 6);
- string++;
- }
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
- return hash;
-}