[asterisk-commits] russell: branch russell/event_performance r183910 - /team/russell/event_perfo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 24 07:50:21 CDT 2009


Author: russell
Date: Tue Mar 24 07:50:18 2009
New Revision: 183910

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183910
Log:
convert dump_cache

Modified:
    team/russell/event_performance/main/event.c

Modified: team/russell/event_performance/main/event.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/event_performance/main/event.c?view=diff&rev=183910&r1=183909&r2=183910
==============================================================================
--- team/russell/event_performance/main/event.c (original)
+++ team/russell/event_performance/main/event.c Tue Mar 24 07:50:18 2009
@@ -410,28 +410,32 @@
 	return 0;
 }
 
+static int dump_cache_cb(void *obj, void *arg, int flags)
+{
+	const struct ast_event_ref *event_ref = obj;
+	const struct ast_event *event = event_ref->event;
+	const struct ast_event_sub *event_sub = arg;
+	struct ast_event_ie_val *ie_val = NULL;
+
+	AST_LIST_TRAVERSE(&event_sub->ie_vals, ie_val, entry) {
+		if (!match_ie_val(event, ie_val, NULL)) {
+			break;
+		}
+	}
+
+	if (!ie_val) {
+		/* All parameters were matched on this cache entry, so dump it */
+		event_sub->cb(event, event_sub->userdata);
+	}
+
+	return 0;
+}
+
 /*! \brief Dump the event cache for the subscribed event type */
 void ast_event_dump_cache(const struct ast_event_sub *event_sub)
 {
-#if 0
-	struct ast_event_ref *event_ref;
-	enum ast_event_type type = event_sub->type;
-
-	AST_RWLIST_RDLOCK(&ast_event_cache[type]);
-	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&ast_event_cache[type], event_ref, entry) {
-		struct ast_event_ie_val *ie_val;
-		AST_LIST_TRAVERSE(&event_sub->ie_vals, ie_val, entry) {
-			if (!match_ie_val(event_ref->event, ie_val, NULL))
-				break;
-		}
-		if (!ie_val) {
-			/* All parameters were matched on this cache entry, so dump it */
-			event_sub->cb(event_ref->event, event_sub->userdata);
-		}
-	}
-	AST_RWLIST_TRAVERSE_SAFE_END
-	AST_RWLIST_UNLOCK(&ast_event_cache[type]);
-#endif
+	ao2_callback(ast_event_cache[event_sub->type].container, OBJ_NODATA,
+			dump_cache_cb, (void *) event_sub);
 }
 
 static struct ast_event *gen_sub_event(struct ast_event_sub *sub)




More information about the asterisk-commits mailing list