<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7926">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  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_cache_pattern: Remove silly usage of RAII_VAR.<br><br>Change-Id: Ic98a51f555062cd863b6db3f8d76065943a9dea3<br>---<br>M main/stasis_cache_pattern.c<br>1 file changed, 22 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/stasis_cache_pattern.c b/main/stasis_cache_pattern.c<br>index 724b307..f0e34b9 100644<br>--- a/main/stasis_cache_pattern.c<br>+++ b/main/stasis_cache_pattern.c<br>@@ -65,8 +65,8 @@<br> struct stasis_cp_all *stasis_cp_all_create(const char *name,<br>     snapshot_get_id id_fn)<br> {<br>-   RAII_VAR(char *, cached_name, NULL, ast_free);<br>-       RAII_VAR(struct stasis_cp_all *, all, NULL, ao2_cleanup);<br>+    char *cached_name = NULL;<br>+    struct stasis_cp_all *all;<br> <br>         all = ao2_t_alloc(sizeof(*all), all_dtor, name);<br>      if (!all) {<br>@@ -75,21 +75,25 @@<br> <br>   ast_asprintf(&cached_name, "%s-cached", name);<br>  if (!cached_name) {<br>+          ao2_ref(all, -1);<br>+<br>          return NULL;<br>  }<br> <br>  all->topic = stasis_topic_create(name);<br>    all->topic_cached = stasis_topic_create(cached_name);<br>+     ast_free(cached_name);<br>        all->cache = stasis_cache_create(id_fn);<br>   all->forward_all_to_cached =<br>               stasis_forward_all(all->topic, all->topic_cached);<br> <br>   if (!all->topic || !all->topic_cached || !all->cache ||<br>              !all->forward_all_to_cached) {<br>+            ao2_ref(all, -1);<br>+<br>          return NULL;<br>  }<br> <br>- ao2_ref(all, +1);<br>     return all;<br> }<br> <br>@@ -134,7 +138,7 @@<br> struct stasis_cp_single *stasis_cp_single_create(struct stasis_cp_all *all,<br>         const char *name)<br> {<br>-        RAII_VAR(struct stasis_cp_single *, one, NULL, ao2_cleanup);<br>+ struct stasis_cp_single *one;<br> <br>      one = stasis_cp_sink_create(all, name);<br>       if (!one) {<br>@@ -142,23 +146,22 @@<br>    }<br> <br>  one->forward_topic_to_all = stasis_forward_all(one->topic, all->topic);<br>-     if (!one->forward_topic_to_all) {<br>-         return NULL;<br>- }<br>     one->forward_cached_to_all = stasis_forward_all(<br>           stasis_caching_get_topic(one->topic_cached), all->topic_cached);<br>-       if (!one->forward_cached_to_all) {<br>+<br>+     if (!one->forward_topic_to_all || !one->forward_cached_to_all) {<br>+               ao2_ref(one, -1);<br>+<br>          return NULL;<br>  }<br> <br>- ao2_ref(one, +1);<br>     return one;<br> }<br> <br> struct stasis_cp_single *stasis_cp_sink_create(struct stasis_cp_all *all,<br>        const char *name)<br> {<br>-        RAII_VAR(struct stasis_cp_single *, one, NULL, ao2_cleanup);<br>+ struct stasis_cp_single *one;<br> <br>      one = ao2_t_alloc(sizeof(*one), one_dtor, name);<br>      if (!one) {<br>@@ -167,14 +170,18 @@<br> <br>         one->topic = stasis_topic_create(name);<br>    if (!one->topic) {<br>-                return NULL;<br>- }<br>-    one->topic_cached = stasis_caching_topic_create(one->topic, all->cache);<br>-    if (!one->topic_cached) {<br>+         ao2_ref(one, -1);<br>+<br>          return NULL;<br>  }<br> <br>- ao2_ref(one, +1);<br>+    one->topic_cached = stasis_caching_topic_create(one->topic, all->cache);<br>+    if (!one->topic_cached) {<br>+         ao2_ref(one, -1);<br>+<br>+         return NULL;<br>+ }<br>+<br>  return one;<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7926">change 7926</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/7926"/><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: Ic98a51f555062cd863b6db3f8d76065943a9dea3 </div>
<div style="display:none"> Gerrit-Change-Number: 7926 </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: 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>