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

Joshua Colp asteriskteam at digium.com
Thu Jan 11 07:28:59 CST 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/7904 )

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(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/main/stasis_message_router.c b/main/stasis_message_router.c
index cf0ac78..498ddd6 100644
--- a/main/stasis_message_router.c
+++ b/main/stasis_message_router.c
@@ -210,7 +210,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) {
@@ -221,6 +221,8 @@
 	res |= AST_VECTOR_INIT(&router->routes, 0);
 	res |= AST_VECTOR_INIT(&router->cache_routes, 0);
 	if (res) {
+		ao2_ref(router, -1);
+
 		return NULL;
 	}
 
@@ -230,10 +232,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/7904
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I50d6ae230920e0b878ed9cc8f79eef746e06701d
Gerrit-Change-Number: 7904
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180111/e8478852/attachment.html>


More information about the asterisk-code-review mailing list