<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7912">View Change</a></p><div style="white-space:pre-wrap">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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis_endpoints: Remove silly usage of RAII_VAR.<br><br>Change-Id: Ic099dc552f36c353c89783a4bcfd09f010432733<br>---<br>M main/stasis_endpoints.c<br>1 file changed, 25 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/stasis_endpoints.c b/main/stasis_endpoints.c<br>index 161fdfa..a3bcd67 100644<br>--- a/main/stasis_endpoints.c<br>+++ b/main/stasis_endpoints.c<br>@@ -305,8 +305,8 @@<br> struct stasis_message *ast_endpoint_blob_create(struct ast_endpoint *endpoint,<br>         struct stasis_message_type *type, struct ast_json *blob)<br> {<br>- RAII_VAR(struct ast_endpoint_blob *, obj, NULL, ao2_cleanup);<br>-        RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);<br>+   struct ast_endpoint_blob *obj;<br>+       struct stasis_message *msg;<br> <br>        if (!type) {<br>          return NULL;<br>@@ -321,37 +321,40 @@<br> <br>        if (endpoint) {<br>               if (!(obj->snapshot = ast_endpoint_snapshot_create(endpoint))) {<br>+                  ao2_ref(obj, -1);<br>+<br>                  return NULL;<br>          }<br>     }<br> <br>  obj->blob = ast_json_ref(blob);<br>+   msg = stasis_message_create(type, obj);<br>+      ao2_ref(obj, -1);<br> <br>- if (!(msg = stasis_message_create(type, obj))) {<br>-             return NULL;<br>- }<br>-<br>- ao2_ref(msg, +1);<br>     return msg;<br> }<br> <br> void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type,<br>  struct ast_json *blob)<br> {<br>-   RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);<br>-       if (blob) {<br>-          message = ast_endpoint_blob_create(endpoint, type, blob);<br>+    struct stasis_message *message;<br>+<br>+   if (!blob) {<br>+         return;<br>       }<br>+<br>+ message = ast_endpoint_blob_create(endpoint, type, blob);<br>     if (message) {<br>                stasis_publish(ast_endpoint_topic(endpoint), message);<br>+               ao2_ref(message, -1);<br>         }<br> }<br> <br> struct ast_endpoint_snapshot *ast_endpoint_latest_snapshot(const char *tech,<br>       const char *name)<br> {<br>-        RAII_VAR(char *, id, NULL, ast_free);<br>-        RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);<br>+   char *id = NULL;<br>+     struct stasis_message *msg;<br>   struct ast_endpoint_snapshot *snapshot;<br> <br>    if (ast_strlen_zero(name)) {<br>@@ -364,8 +367,8 @@<br>     }<br>     ast_tech_to_upper(id);<br> <br>-    msg = stasis_cache_get(ast_endpoint_cache(),<br>-         ast_endpoint_snapshot_type(), id);<br>+   msg = stasis_cache_get(ast_endpoint_cache(), ast_endpoint_snapshot_type(), id);<br>+      ast_free(id);<br>         if (!msg) {<br>           return NULL;<br>  }<br>@@ -374,6 +377,8 @@<br>        ast_assert(snapshot != NULL);<br> <br>      ao2_ref(snapshot, +1);<br>+       ao2_ref(msg, -1);<br>+<br>  return snapshot;<br> }<br> <br>@@ -406,7 +411,7 @@<br>  const struct ast_endpoint_snapshot *snapshot,<br>         const struct stasis_message_sanitizer *sanitize)<br> {<br>- RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);<br>+     struct ast_json *json;<br>        struct ast_json *channel_array;<br>       int i;<br> <br>@@ -424,6 +429,8 @@<br>                int res = ast_json_object_set(json, "max_channels",<br>                         ast_json_integer_create(snapshot->max_channels));<br>          if (res != 0) {<br>+                      ast_json_unref(json);<br>+<br>                      return NULL;<br>          }<br>     }<br>@@ -441,11 +448,13 @@<br>              res = ast_json_array_append(channel_array,<br>                    ast_json_string_create(snapshot->channel_ids[i]));<br>                 if (res != 0) {<br>+                      ast_json_unref(json);<br>+<br>                      return NULL;<br>          }<br>     }<br> <br>- return ast_json_ref(json);<br>+   return json;<br> }<br> <br> static void endpoints_stasis_cleanup(void)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7912">change 7912</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/7912"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ic099dc552f36c353c89783a4bcfd09f010432733 </div>
<div style="display:none"> Gerrit-Change-Number: 7912 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>