aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-22 22:43:12 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-22 22:43:12 +0000
commitafb545d2f88ee521d1098a4835a83a94e8af00f4 (patch)
treee948e8607893e4c0198ff4b1dd9cfbf1cf0c9205 /main
parentc5747a3589eb4dd47185572256b06a627afba1b7 (diff)
Merged revisions 80424 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r80424 | russell | 2007-08-22 17:40:27 -0500 (Wed, 22 Aug 2007) | 10 lines When converting this code to use the list macros, I changed it so objects are added to the head of a bucket instead of the tail. However, while looking over code with mmichelson, we noticed that the algorithm used in ao2_iterator_next requires that items are added to the tail. This wouldn't have caused any huge problem, but it wasn't correct. It meant that if an object was added to a container while you were iterating it, and it was added to the same bucket that the current element is in, then the new object would be returned by ao2_iterator_next, and any other objects in the bucket would be bypassed in the traversal. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@80425 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/astobj2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 9d2b0af2c..4f338af44 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -339,7 +339,7 @@ void *ao2_link(ao2_container *c, void *user_data)
i %= c->n_buckets;
p->astobj = obj;
p->version = ast_atomic_fetchadd_int(&c->version, 1);
- AST_LIST_INSERT_HEAD(&c->buckets[i], p, entry);
+ AST_LIST_INSERT_TAIL(&c->buckets[i], p, entry);
ast_atomic_fetchadd_int(&c->elements, 1);
ao2_unlock(c);