[Asterisk-code-review] stasis message router: Remove silly usage of RAII VAR. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Tue Jan 9 18:55:46 CST 2018


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7910


Change subject: stasis_message_router: Remove silly usage of RAII_VAR.
......................................................................

stasis_message_router: Remove silly usage of RAII_VAR.

Change-Id: I50d6ae230920e0b878ed9cc8f79eef746e06701d
---
M main/stasis_message_router.c
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/7910/1

diff --git a/main/stasis_message_router.c b/main/stasis_message_router.c
index 2c8d0a7..41d426b 100644
--- a/main/stasis_message_router.c
+++ b/main/stasis_message_router.c
@@ -208,7 +208,7 @@
 	struct stasis_topic *topic, int use_thread_pool)
 {
 	int res;
-	RAII_VAR(struct stasis_message_router *, router, NULL, ao2_cleanup);
+	struct stasis_message_router *router;
 
 	router = ao2_t_alloc(sizeof(*router), router_dtor, stasis_topic_name(topic));
 	if (!router) {
@@ -219,6 +219,8 @@
 	res |= AST_VECTOR_INIT(&router->routes, 0);
 	res |= AST_VECTOR_INIT(&router->cache_routes, 0);
 	if (res) {
+		ao2_ref(router, -1);
+
 		return NULL;
 	}
 
@@ -228,10 +230,11 @@
 		router->subscription = stasis_subscribe(topic, router_dispatch, router);
 	}
 	if (!router->subscription) {
+		ao2_ref(router, -1);
+
 		return NULL;
 	}
 
-	ao2_ref(router, +1);
 	return router;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/7910
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I50d6ae230920e0b878ed9cc8f79eef746e06701d
Gerrit-Change-Number: 7910
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180109/60610332/attachment.html>


More information about the asterisk-code-review mailing list