<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7018">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stasis/app.c: Optimize stasis_app_get_debug_by_name()<br><br>* Eliminate RAII_VAR()<br>* Short circuit application name lookup if global debug enabled.<br><br>Change-Id: I5f78b7bd6ca7fd2c3b07cbbe036c6a93b4681123<br>---<br>M res/stasis/app.c<br>1 file changed, 14 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/7018/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/stasis/app.c b/res/stasis/app.c<br>index b0bcf3c..0b44bf3 100644<br>--- a/res/stasis/app.c<br>+++ b/res/stasis/app.c<br>@@ -871,9 +871,21 @@<br> <br> int stasis_app_get_debug_by_name(const char *app_name)<br> {<br>-       RAII_VAR(struct stasis_app *, app, stasis_app_get_by_name(app_name), ao2_cleanup);<br>+   int debug_enabled = 0;<br> <br>-    return (app ? app->debug : 0) || global_debug;<br>+    if (global_debug) {<br>+          debug_enabled = 1;<br>+   } else {<br>+             struct stasis_app *app = stasis_app_get_by_name(app_name);<br>+<br>+                if (app) {<br>+                   if (app->debug) {<br>+                         debug_enabled = 1;<br>+                   }<br>+                    ao2_ref(app, -1);<br>+            }<br>+    }<br>+    return debug_enabled;<br> }<br> <br> void stasis_app_set_global_debug(int debug)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7018">change 7018</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/7018"/><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: I5f78b7bd6ca7fd2c3b07cbbe036c6a93b4681123 </div>
<div style="display:none"> Gerrit-Change-Number: 7018 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>