[asterisk-commits] qwell: branch qwell/router_removal r390569 - in /team/qwell/router_removal: i...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 5 15:12:15 CDT 2013


Author: qwell
Date: Wed Jun  5 15:12:12 2013
New Revision: 390569

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390569
Log:
Make route removal more betterer.

Modified:
    team/qwell/router_removal/include/asterisk/stasis_message_router.h
    team/qwell/router_removal/main/stasis_message_router.c

Modified: team/qwell/router_removal/include/asterisk/stasis_message_router.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/router_removal/include/asterisk/stasis_message_router.h?view=diff&rev=390569&r1=390568&r2=390569
==============================================================================
--- team/qwell/router_removal/include/asterisk/stasis_message_router.h (original)
+++ team/qwell/router_removal/include/asterisk/stasis_message_router.h Wed Jun  5 15:12:12 2013
@@ -116,12 +116,9 @@
  * \param router Router to remove the route from.
  * \param message_type Type of message to route.
  *
- * \retval 0 on success
- * \retval -1 on failure
- *
  * \since 12
  */
-int stasis_message_router_remove(struct stasis_message_router *router,
+void stasis_message_router_remove(struct stasis_message_router *router,
 			      struct stasis_message_type *message_type);
 
 /*!

Modified: team/qwell/router_removal/main/stasis_message_router.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/router_removal/main/stasis_message_router.c?view=diff&rev=390569&r1=390568&r2=390569
==============================================================================
--- team/qwell/router_removal/main/stasis_message_router.c (original)
+++ team/qwell/router_removal/main/stasis_message_router.c Wed Jun  5 15:12:12 2013
@@ -219,13 +219,6 @@
 	return 0;
 }
 
-static int remove_route(struct stasis_message_router *router,
-			struct stasis_message_route *route)
-{
-	ao2_unlink(router->routes, route);
-	return 0;
-}
-
 int stasis_message_router_add(struct stasis_message_router *router,
 			      struct stasis_message_type *message_type,
 			      stasis_subscription_cb callback,
@@ -241,17 +234,12 @@
 	return add_route(router, route);
 }
 
-int stasis_message_router_remove(struct stasis_message_router *router,
+void stasis_message_router_remove(struct stasis_message_router *router,
 			      struct stasis_message_type *message_type)
 {
 	SCOPED_AO2LOCK(lock, router);
-	RAII_VAR(struct stasis_message_route *, route, NULL, ao2_cleanup);
-
-	if (!(route = find_route(router, message_type))) {
-		return -1;
-	}
-
-	return remove_route(router, route);
+
+	ao2_find(router->routes, message_type, OBJ_UNLINK | OBJ_NODATA | OBJ_KEY);
 }
 
 int stasis_message_router_set_default(struct stasis_message_router *router,




More information about the asterisk-commits mailing list