diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-09-18 04:34:38 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-09-18 04:40:20 +0300 |
commit | 76a699701cda144af96f77061b036c7afc10fce4 (patch) | |
tree | 661eb71c16f5d13e34b025d280ab95a3d9ae7b3c /rpmio/rpmstring.c | |
parent | bef4be688de3b29fe62d10bf723ad888111853aa (diff) | |
download | librpm-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.c | 17 |
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; -} |