aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_phoneprov.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-29 17:47:17 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-29 17:47:17 +0000
commit91df49dd46d7cbceb5eb7080a4b374ab024876f9 (patch)
tree60afe0702c0b3d5e4620a3f0fe944af1b9852f67 /res/res_phoneprov.c
parent1c53b40b496418ccd93e270d070bbb252fdee215 (diff)
Merged revisions 140488 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r140488 | mmichelson | 2008-08-29 12:34:17 -0500 (Fri, 29 Aug 2008) | 22 lines After working on the ao2_containers branch, I noticed something a bit strange. In all cases where we provide a callback function to ao2_container_alloc, the callback function would only return 0 or CMP_MATCH. After inspecting the ao2_callback() code carefully, I found that if you're only looking for one specific item, then you should return CMP_MATCH | CMP_STOP. Otherwise, astobj2 will continue traversing the current bucket until the end searching for more matches. In cases like chan_iax2 where in 1.4, all the peers are shoved into a single bucket, this makes for potentially terrible performance since the entire bucket will be traversed even if the peer is one of the first ones come across in the bucket. All the changes I have made were for cases where the callback function defined was passed to ao2_container_alloc so that calls to ao2_find could find a unique instance of whatever object was being stored in the container. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@140489 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_phoneprov.c')
-rw-r--r--res/res_phoneprov.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 3fcc19a19..54c094294 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -249,7 +249,7 @@ static int profile_cmp_fn(void *obj, void *arg, int flags)
{
const struct phone_profile *profile1 = obj, *profile2 = arg;
- return !strcasecmp(profile1->name, profile2->name) ? CMP_MATCH : 0;
+ return !strcasecmp(profile1->name, profile2->name) ? CMP_MATCH | CMP_STOP : 0;
}
static void delete_file(struct phoneprov_file *file)
@@ -295,7 +295,7 @@ static int routes_cmp_fn(void *obj, void *arg, int flags)
{
const struct http_route *route1 = obj, *route2 = arg;
- return !strcmp(route1->uri, route2->uri) ? CMP_MATCH : 0;
+ return !strcmp(route1->uri, route2->uri) ? CMP_MATCH | CMP_STOP : 0;
}
static void route_destructor(void *obj)
@@ -784,7 +784,7 @@ static int users_cmp_fn(void *obj, void *arg, int flags)
{
const struct user *user1 = obj, *user2 = arg;
- return !strcasecmp(user1->macaddress, user2->macaddress) ? CMP_MATCH : 0;
+ return !strcasecmp(user1->macaddress, user2->macaddress) ? CMP_MATCH | CMP_STOP : 0;
}
/*! \brief Free all memory associated with a user */