mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-06 21:09:47 +00:00
Re-work ref count handling of MoH classes using astobj2 to resolve crashes.
(closes issue #13566) Reported by: igorcarneiro Tested by: russell Review: http://reviewboard.digium.com/r/106/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@166262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "asterisk/inline_api.h"
|
#include "asterisk/inline_api.h"
|
||||||
#include "asterisk/compiler.h"
|
#include "asterisk/compiler.h"
|
||||||
@@ -282,4 +283,22 @@ static force_inline int ast_str_hash(const char *str)
|
|||||||
return abs(hash);
|
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 */
|
#endif /* _ASTERISK_STRINGS_H */
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user