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:
Anthony Minessale
2008-11-03 20:08:44 +00:00
parent d4087da371
commit 7074c7abdd
5 changed files with 80 additions and 6 deletions
+2
View File
@@ -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
+2
View File
@@ -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;
};
+34
View File
@@ -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