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

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Oct 22 08:06:15 MST 2006


Author: rizzo
Date: Sun Oct 22 10:06:15 2006
New Revision: 45886

URL: http://svn.digium.com/view/asterisk?rev=45886&view=rev
Log:
backup time...


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=45886&r1=45885&r2=45886&view=diff
==============================================================================
--- team/rizzo/astobj2/main/astobj2.c (original)
+++ team/rizzo/astobj2/main/astobj2.c Sun Oct 22 10:06:15 2006
@@ -531,12 +531,20 @@
 	ast_cli(fd, "testing callbacks");
 	astobj2_callback(c1, 0, print_cb, (void*)fd);
 
-	ast_cli(fd, "testing iterators");
+	ast_cli(fd, "testing iterators, remove every second object");
 	astobj2_iterator_init(c1, &ai);
-
+{
+	int x = 0;
 	while ( (obj = astobj2_iterator_next(&ai)) ) {
 		ast_cli(fd, "iterator on <%s>", obj);
-	}
+		if (x++ & 1) {
+		    astobj2_unlink(c1, obj);
+		    astobj2_ref(obj, -1);
+		}
+	}
+}
+	ast_cli(fd, "testing callbacks again");
+	astobj2_callback(c1, 0, print_cb, (void*)fd);
 
 	astobj2_ref(c1, -1);	/* destroy all */
 	return 0;



More information about the svn-commits mailing list