[Asterisk-code-review] stasis system: Remove silly usage of RAII VAR. (asterisk[15])

Jenkins2 asteriskteam at digium.com
Thu Jan 11 07:21:30 CST 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7907 )

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

stasis_system: Remove silly usage of RAII_VAR.

Change-Id: Iedbe5656cee68cd3a96a953558764aa02d4a0c3b
---
M main/stasis_system.c
1 file changed, 10 insertions(+), 5 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
  Jenkins2: Approved for Submit



diff --git a/main/stasis_system.c b/main/stasis_system.c
index ee4f6bc..961a2b0 100644
--- a/main/stasis_system.c
+++ b/main/stasis_system.c
@@ -117,9 +117,9 @@
 
 void ast_system_publish_registry(const char *channeltype, const char *username, const char *domain, const char *status, const char *cause)
 {
-	RAII_VAR(struct ast_json *, registry, NULL, ast_json_unref);
-	RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
-	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+	struct ast_json *registry;
+	struct ast_json_payload *payload;
+	struct stasis_message *message;
 
 	if (!ast_system_registry_type()) {
 		return;
@@ -133,15 +133,20 @@
 		"status", status,
 		"cause", S_OR(cause, ""));
 
-	if (!(payload = ast_json_payload_create(registry))) {
+	payload = ast_json_payload_create(registry);
+	ast_json_unref(registry);
+	if (!payload) {
 		return;
 	}
 
-	if (!(message = stasis_message_create(ast_system_registry_type(), payload))) {
+	message = stasis_message_create(ast_system_registry_type(), payload);
+	ao2_ref(payload, -1);
+	if (!message) {
 		return;
 	}
 
 	stasis_publish(ast_system_topic(), message);
+	ao2_ref(message, -1);
 }
 
 static struct ast_manager_event_blob *system_registry_to_ami(struct stasis_message *message)

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

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: Iedbe5656cee68cd3a96a953558764aa02d4a0c3b
Gerrit-Change-Number: 7907
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/69fb63df/attachment.html>


More information about the asterisk-code-review mailing list