summaryrefslogtreecommitdiff
path: root/res/res_phoneprov.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2008-11-14 17:29:05 +0000
committerTerry Wilson <twilson@digium.com>2008-11-14 17:29:05 +0000
commit401b8bea76c5e5f4430e0a06b3707f13c739f608 (patch)
tree1211944fd4c5e4a19b165bfabff462eebdd440c9 /res/res_phoneprov.c
parent777d5ee47033a2d4746a675ce07c808ff03ec89d (diff)
Use Mark's new ast_str_case_hash function instead of jumping through hoops to do insensitive case lookups
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@156916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_phoneprov.c')
-rw-r--r--res/res_phoneprov.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 5646d2d02..9536fc35f 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -28,7 +28,6 @@
#include "asterisk.h"
-#include <ctype.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -245,7 +244,7 @@ static int profile_hash_fn(const void *obj, const int flags)
{
const struct phone_profile *profile = obj;
- return ast_str_hash(profile->name);
+ return ast_str_case_hash(profile->name);
}
static int profile_cmp_fn(void *obj, void *arg, void *data, int flags)
@@ -290,15 +289,8 @@ static struct http_route *unref_route(struct http_route *route)
static int routes_hash_fn(const void *obj, const int flags)
{
const struct http_route *route = obj;
- char *tmp, *uri;
-
- uri = tmp = ast_strdupa(route->uri);
- while (*tmp++) {
- *tmp = tolower(*tmp);
- }
-
- return ast_str_hash(uri);
+ return ast_str_case_hash(route->uri);
}
static int routes_cmp_fn(void *obj, void *arg, void *data, int flags)
@@ -792,15 +784,8 @@ static struct user *find_user(const char *macaddress)
static int users_hash_fn(const void *obj, const int flags)
{
const struct user *user = obj;
- char *tmp, *mac;
-
- mac = tmp = ast_strdupa(user->macaddress);
-
- while (*tmp++) {
- *tmp = tolower(*tmp);
- }
- return ast_str_hash(mac);
+ return ast_str_case_hash(user->macaddress);
}
static int users_cmp_fn(void *obj, void *arg, void *data, int flags)
@@ -844,7 +829,7 @@ static void delete_users(void)
static struct user *build_user(const char *mac, struct phone_profile *profile)
{
struct user *user;
-
+
if (!(user = ao2_alloc(sizeof(*user), user_destructor))) {
profile = unref_profile(profile);
return NULL;