[svn-commits] rizzo: branch rizzo/astobj2 r47297 - /team/rizzo/astobj2/main/astobj2.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Nov 7 16:01:30 MST 2006


Author: rizzo
Date: Tue Nov  7 17:01:29 2006
New Revision: 47297

URL: http://svn.digium.com/view/asterisk?rev=47297&view=rev
Log:
should increment, not decrement the version number.

also track the number of elements in the container, but this
needs a fix in the callback to count how many elements are deleted
(here and elsewhere). Probably the fix should be applied elsewhere, in fact.


Modified:
    team/rizzo/astobj2/main/astobj2.c

Modified: team/rizzo/astobj2/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/main/astobj2.c?rev=47297&r1=47296&r2=47297&view=diff
==============================================================================
--- team/rizzo/astobj2/main/astobj2.c (original)
+++ team/rizzo/astobj2/main/astobj2.c Tue Nov  7 17:01:29 2006
@@ -282,7 +282,9 @@
 	// ast_verbose("unlinking %p from container\n", user_data);
 	astobj2_callback(c, OBJ_SINGLE | OBJ_UNLINK | OBJ_POINTER, match_by_addr, user_data);
 	/* the container has changed its content, so we update the version */
-	ast_atomic_fetchadd_int(&c->version, -1);
+	ast_atomic_fetchadd_int(&c->version, 1);
+	/* XXX actually we should check whether the callback succeeds or not */
+	ast_atomic_fetchadd_int(&c->elements, -1);
 	astobj2_ref(user_data, -1);
 	return NULL;
 }



More information about the svn-commits mailing list