[asterisk-commits] twilson: branch twilson/calendaring r161419 - /team/twilson/calendaring/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 5 14:43:18 CST 2008


Author: twilson
Date: Fri Dec  5 14:43:18 2008
New Revision: 161419

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161419
Log:
another ao2_callback conversion

Modified:
    team/twilson/calendaring/main/calendar.c

Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=161419&r1=161418&r2=161419
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Fri Dec  5 14:43:18 2008
@@ -217,11 +217,21 @@
 	return 0;
 }
 
+static int match_caltech_cb(void *user_data, void *arg, int flags)
+{
+	struct ast_calendar *cal = user_data;
+	struct ast_calendar_tech *tech = arg;
+
+	if (cal->tech == tech) {
+		return CMP_MATCH;
+	}
+
+	return 0;
+}
+
 void ast_calendar_unregister(const struct ast_calendar_tech *tech)
 {
 	struct caltechlist *caltech_list;
-	struct ast_calendar *cal;
-	struct ao2_iterator i;
 
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&techs, caltech_list, list) {
@@ -229,13 +239,7 @@
 			continue;
 		}
 
-		i = ao2_iterator_init(calendars, 0);
-		while ((cal = ao2_iterator_next(&i))) {
-			if (cal->tech == tech) {
-				ao2_unlink(calendars, cal);
-				cal = unref_calendar(cal);
-			}
-		}
+		ao2_callback(calendars, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, match_caltech_cb, (struct ast_calendar_tech *) tech);
 
 		AST_LIST_REMOVE_CURRENT(list);
 		ast_verb(2, "Unregistered calendar type '%s'\n", tech->type);




More information about the asterisk-commits mailing list