diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-14 16:55:53 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-14 16:55:53 +0000 |
commit | 2a39137f85b8821b5c3e5e7cd6a2a1efebd22b2a (patch) | |
tree | 6f66029a30b8c3cfb2844f45c4ae7ec677ee8fdb /include | |
parent | 52f1a195f62a55ac12939e27a04956aaad4f38c7 (diff) |
This is the 1.6.0 version of revision 156883 of trunk.
This is different in that it preserves the case-sensitiveness
of processing queues from configuration.
closes issue #13703
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@156889 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/strings.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 79dac8700..4f5e326cf 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -23,6 +23,8 @@ #ifndef _ASTERISK_STRINGS_H #define _ASTERISK_STRINGS_H +#include <ctype.h> + #include "asterisk/inline_api.h" #include "asterisk/utils.h" #include "asterisk/threadstorage.h" @@ -702,4 +704,21 @@ static force_inline int ast_str_hash(const char *str) return abs(hash); } +/*! + * \brief Compute a hash value on a case-insensitive string + * + * Uses the same hash algorithm as ast_str_hash, but converts + * all characters to lowercase prior to computing a hash. This + * allows for easy case-insensitive lookups in a hash table. + */ +static force_inline int ast_str_case_hash(const char *str) +{ + int hash = 5381; + + while (*str) { + hash = hash * 33 ^ tolower(*str++); + } + + return abs(hash); +} #endif /* _ASTERISK_STRINGS_H */ |