diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2011-03-10 09:00:07 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2011-03-10 10:17:39 +0200 |
commit | 805f7fd5af6fb4527f8487049565437a4ab11ecd (patch) | |
tree | f25b9229501024b9497cd322b29d7ef5a4791a4c /rpmio/rpmstring.h | |
parent | ba38b2551f51538885df60b849906de005fb78ed (diff) | |
download | librpm-tizen-805f7fd5af6fb4527f8487049565437a4ab11ecd.tar.gz librpm-tizen-805f7fd5af6fb4527f8487049565437a4ab11ecd.tar.bz2 librpm-tizen-805f7fd5af6fb4527f8487049565437a4ab11ecd.zip |
Move string hash function to librpmio and rename for namespacing
- There are places in rpmio and build that would benefit from hashing, but
hashFunctionString() being internal to librpm has prevented that. Rename
to rstrhash() to resemble the other foo in rpmstring.h for
minimal namespacing as its now public function and update callers.
- Also mark the function as "pure" - it only looks at its arguments.
This is one of the busiest functions in entire rpm so any optimization
no matter how minor is well worth it.
- Hereby awarding hashFunctionString() with the grand prize for
the Most Moved Around Function in rpm ;)
Diffstat (limited to 'rpmio/rpmstring.h')
-rw-r--r-- | rpmio/rpmstring.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rpmio/rpmstring.h b/rpmio/rpmstring.h index 4e8a5dbf7..a1d90d8ee 100644 --- a/rpmio/rpmstring.h +++ b/rpmio/rpmstring.h @@ -172,6 +172,14 @@ char *rstrscat(char **dest, const char *arg, ...) RPM_GNUC_NULL_TERMINATED; */ size_t rstrlcpy(char *dest, const char *src, size_t n); +/** \ingroup rpmstring + * String hashing function + * @param string string to hash + * @return hash id + */ +RPM_GNUC_PURE +unsigned int rstrhash(const char * string); + #ifdef __cplusplus } #endif |