<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7324">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ccss: Remove silly usage of RAII_VAR.<br><br>Change-Id: I5ce40035e0a940e4e56f6322c1dcd47fbd509b98<br>---<br>M main/ccss.c<br>1 file changed, 32 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/24/7324/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/ccss.c b/main/ccss.c<br>index a9d15b0..445de93 100644<br>--- a/main/ccss.c<br>+++ b/main/ccss.c<br>@@ -1022,9 +1022,9 @@<br> <br> static int cc_publish(struct stasis_message_type *message_type, int core_id, struct ast_json *extras)<br> {<br>- RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);<br>- RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);<br>- RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);<br>+ struct ast_json *blob;<br>+ struct ast_json_payload *payload;<br>+ struct stasis_message *message;<br> <br> if (!message_type) {<br> return -1;<br>@@ -1040,121 +1040,138 @@<br> ast_json_object_update(blob, extras);<br> }<br> <br>- if (!(payload = ast_json_payload_create(blob))) {<br>+ payload = ast_json_payload_create(blob);<br>+ ast_json_unref(blob);<br>+<br>+ if (!payload) {<br> return -1;<br> }<br> <br>- if (!(message = stasis_message_create(message_type, payload))) {<br>+ message = stasis_message_create(message_type, payload);<br>+ ao2_ref(payload, -1);<br>+<br>+ if (!message) {<br> return -1;<br> }<br> <br> stasis_publish(ast_system_topic(), message);<br>+ ao2_ref(message, -1);<br> <br> return 0;<br> }<br> <br> static void cc_publish_available(int core_id, const char *callee, const char *service)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s, s: s}",<br> "callee", callee,<br> "service", service);<br> <br> cc_publish(ast_cc_available_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_offertimerstart(int core_id, const char *caller, unsigned int expires)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s, s: i}",<br> "caller", caller,<br> "expires", expires);<br> <br> cc_publish(ast_cc_offertimerstart_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_requested(int core_id, const char *caller, const char *callee)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s, s: s}",<br> "caller", caller,<br> "callee", callee);<br> <br> cc_publish(ast_cc_requested_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_requestacknowledged(int core_id, const char *caller)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "caller", caller);<br> <br> cc_publish(ast_cc_requestacknowledged_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_callerstopmonitoring(int core_id, const char *caller)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "caller", caller);<br> <br> cc_publish(ast_cc_callerstopmonitoring_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_callerstartmonitoring(int core_id, const char *caller)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "caller", caller);<br> <br> cc_publish(ast_cc_callerstartmonitoring_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_callerrecalling(int core_id, const char *caller)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "caller", caller);<br> <br> cc_publish(ast_cc_callerrecalling_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_recallcomplete(int core_id, const char *caller)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "caller", caller);<br> <br> cc_publish(ast_cc_recallcomplete_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_failure(int core_id, const char *caller, const char *reason)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s, s: s}",<br> "caller", caller,<br> "reason", reason);<br> <br> cc_publish(ast_cc_failure_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> static void cc_publish_monitorfailed(int core_id, const char *callee)<br> {<br>- RAII_VAR(struct ast_json *, extras, NULL, ast_json_unref);<br>+ struct ast_json *extras;<br> <br> extras = ast_json_pack("{s: s}",<br> "callee", callee);<br> <br> cc_publish(ast_cc_monitorfailed_type(), core_id, extras);<br>+ ast_json_unref(extras);<br> }<br> <br> struct cc_monitor_backend {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7324">change 7324</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7324"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5ce40035e0a940e4e56f6322c1dcd47fbd509b98 </div>
<div style="display:none"> Gerrit-Change-Number: 7324 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>