[Asterisk-code-review] stasis: Remove silly use of RAII VAR in stasis forward all. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Tue Nov 7 08:52:40 CST 2017


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

Change subject: stasis: Remove silly use of RAII_VAR in stasis_forward_all.
......................................................................

stasis: Remove silly use of RAII_VAR in stasis_forward_all.

Change-Id: I46de4c968d40144d5b049966304ff66c1469fb65
---
M main/stasis.c
1 file changed, 4 insertions(+), 3 deletions(-)

Approvals:
  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.c b/main/stasis.c
index 48e4eb5..372e919 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -910,7 +910,7 @@
 {
 	int res;
 	size_t idx;
-	RAII_VAR(struct stasis_forward *, forward, NULL, ao2_cleanup);
+	struct stasis_forward *forward;
 
 	if (!from_topic || !to_topic) {
 		return NULL;
@@ -923,7 +923,7 @@
 
 	/* Forwards to ourselves are implicit. */
 	if (to_topic == from_topic) {
-		return ao2_bump(forward);
+		return forward;
 	}
 
 	forward->from_topic = ao2_bump(from_topic);
@@ -934,6 +934,7 @@
 	if (res != 0) {
 		ao2_unlock(from_topic);
 		ao2_unlock(to_topic);
+		ao2_ref(forward, -1);
 		return NULL;
 	}
 
@@ -943,7 +944,7 @@
 	ao2_unlock(from_topic);
 	ao2_unlock(to_topic);
 
-	return ao2_bump(forward);
+	return forward;
 }
 
 static void subscription_change_dtor(void *obj)

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I46de4c968d40144d5b049966304ff66c1469fb65
Gerrit-Change-Number: 7030
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.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/20171107/168b8262/attachment.html>


More information about the asterisk-code-review mailing list