mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 04:31:50 +00:00
add hashing to event header lookup
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10227 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -202,6 +202,8 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht);
|
||||
*/
|
||||
SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen);
|
||||
|
||||
SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, switch_ssize_t *klen);
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup switch_time Time Routines
|
||||
|
||||
@@ -67,6 +67,8 @@ SWITCH_BEGIN_EXTERN_C
|
||||
char *name;
|
||||
/*! the header value */
|
||||
char *value;
|
||||
/*! hash of the header name */
|
||||
unsigned long hash;
|
||||
struct switch_event_header *next;
|
||||
};
|
||||
|
||||
|
||||
@@ -295,6 +295,40 @@ static inline char *switch_safe_strdup(const char *it)
|
||||
}
|
||||
|
||||
|
||||
static inline char *switch_lc_strdup(const char *it)
|
||||
{
|
||||
char *dup;
|
||||
char *p;
|
||||
|
||||
if (it) {
|
||||
dup = strdup(it);
|
||||
for(p = dup; p && *p; p++) {
|
||||
*p = tolower(*p);
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static inline char *switch_uc_strdup(const char *it)
|
||||
{
|
||||
char *dup;
|
||||
char *p;
|
||||
|
||||
if (it) {
|
||||
dup = strdup(it);
|
||||
for(p = dup; p && *p; p++) {
|
||||
*p = toupper(*p);
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Test if one string is inside another with extra case checking
|
||||
\param s the inner string
|
||||
|
||||
Reference in New Issue
Block a user