I found this sillyness when I did my ast_module_user conversion. Return immediately...
authorJoshua Colp <jcolp@digium.com>
Mon, 16 Jul 2007 15:57:01 +0000 (15:57 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 16 Jul 2007 15:57:01 +0000 (15:57 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75227 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_verbose.c

index 130bfa2..e4808b4 100644 (file)
@@ -54,39 +54,39 @@ static char *log_descrip =
 
 static int verbose_exec(struct ast_channel *chan, void *data)
 {
 
 static int verbose_exec(struct ast_channel *chan, void *data)
 {
-       char *vtext;
+       char *vtext, *tmp;
        int vsize;
 
        int vsize;
 
-       if (data) {
-               char *tmp;
-               vtext = ast_strdupa(data);
-               tmp = strsep(&vtext, "|");
-               if (vtext) {
-                       if (sscanf(tmp, "%d", &vsize) != 1) {
-                               vsize = 0;
-                               ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
-                       }
-               } else {
-                       vtext = tmp;
+       if (ast_strlen_zero(data))
+               return 0;
+       
+       vtext = ast_strdupa(data);
+       tmp = strsep(&vtext, "|");
+       if (vtext) {
+               if (sscanf(tmp, "%d", &vsize) != 1) {
                        vsize = 0;
                        vsize = 0;
+                       ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
                }
                }
-               if (option_verbose >= vsize) {
-                       switch (vsize) {
-                       case 0:
-                               ast_verbose("%s\n", vtext);
-                               break;
-                       case 1:
-                               ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
-                               break;
-                       case 2:
-                               ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
-                               break;
-                       case 3:
-                               ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
-                               break;
-                       default:
-                               ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
-                       }
+       } else {
+               vtext = tmp;
+               vsize = 0;
+       }
+       if (option_verbose >= vsize) {
+               switch (vsize) {
+               case 0:
+                       ast_verbose("%s\n", vtext);
+                       break;
+               case 1:
+                       ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
+                       break;
+               case 2:
+                       ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
+                       break;
+               case 3:
+                       ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
+                       break;
+               default:
+                       ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
                }
        }
 
                }
        }