remove lots of useless checks of the result of ast_strdupa
[asterisk/asterisk.git] / apps / app_exec.c
old mode 100755 (executable)
new mode 100644 (file)
index 50a8a27..b2a45dc
@@ -20,6 +20,8 @@
  * \brief Exec application
  *
  * \author Tilghman Lesher <app_exec__v001@the-tilghman.com>
  * \brief Exec application
  *
  * \author Tilghman Lesher <app_exec__v001@the-tilghman.com>
+ *
+ * \ingroup applications
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
@@ -71,27 +73,22 @@ static int exec_exec(struct ast_channel *chan, void *data)
 
        /* Check and parse arguments */
        if (data) {
 
        /* Check and parse arguments */
        if (data) {
-               s = ast_strdupa((char *)data);
+               s = ast_strdupa(data);
+               appname = strsep(&s, "(");
                if (s) {
                if (s) {
-                       appname = strsep(&s, "(");
-                       if (s) {
-                               endargs = strrchr(s, ')');
-                               if (endargs)
-                                       *endargs = '\0';
-                               pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
-                       }
-                       if (appname) {
-                               app = pbx_findapp(appname);
-                               if (app) {
-                                       res = pbx_exec(chan, app, args, 1);
-                               } else {
-                                       ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
-                                       res = -1;
-                               }
+                       endargs = strrchr(s, ')');
+                       if (endargs)
+                               *endargs = '\0';
+                       pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+               }
+               if (appname) {
+                       app = pbx_findapp(appname);
+                       if (app) {
+                               res = pbx_exec(chan, app, args, 1);
+                       } else {
+                               ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+                               res = -1;
                        }
                        }
-               } else {
-                       ast_log(LOG_ERROR, "Out of memory\n");
-                       res = -1;
                }
        }
 
                }
        }