summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-11-07 07:46:14 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-07 07:46:14 -0600
commitd39e97f4b34b774e83ffcb07c5424eea7b5f633f (patch)
tree3194cde0b709843daa1f870ccd9bbedfaa3fda0d
parent7ccac5e088dda8df6f06c5c127ed065ddcf0e41c (diff)
parent6bec8fdd72991b305b39ee2941b12a5d3b76ceec (diff)
Merge "stasis/app.c: Optimize stasis_app_get_debug_by_name()" into 15
-rw-r--r--res/stasis/app.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/res/stasis/app.c b/res/stasis/app.c
index b0bcf3c42..0b44bf3c6 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -871,9 +871,21 @@ int stasis_app_get_debug(struct stasis_app *app)
int stasis_app_get_debug_by_name(const char *app_name)
{
- RAII_VAR(struct stasis_app *, app, stasis_app_get_by_name(app_name), ao2_cleanup);
+ int debug_enabled = 0;
- return (app ? app->debug : 0) || global_debug;
+ if (global_debug) {
+ debug_enabled = 1;
+ } else {
+ struct stasis_app *app = stasis_app_get_by_name(app_name);
+
+ if (app) {
+ if (app->debug) {
+ debug_enabled = 1;
+ }
+ ao2_ref(app, -1);
+ }
+ }
+ return debug_enabled;
}
void stasis_app_set_global_debug(int debug)