[asterisk-commits] twilson: trunk r156916 - /trunk/res/res_phoneprov.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 14 11:29:06 CST 2008


Author: twilson
Date: Fri Nov 14 11:29:05 2008
New Revision: 156916

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156916
Log:
Use Mark's new ast_str_case_hash function instead of jumping through hoops to do insensitive case lookups

Modified:
    trunk/res/res_phoneprov.c

Modified: trunk/res/res_phoneprov.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_phoneprov.c?view=diff&rev=156916&r1=156915&r2=156916
==============================================================================
--- trunk/res/res_phoneprov.c (original)
+++ trunk/res/res_phoneprov.c Fri Nov 14 11:29:05 2008
@@ -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 @@
 {
 	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 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 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 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;




More information about the asterisk-commits mailing list