[asterisk-commits] file: trunk r75227 - /trunk/apps/app_verbose.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 16 10:57:01 CDT 2007
Author: file
Date: Mon Jul 16 10:57:01 2007
New Revision: 75227
URL: http://svn.digium.com/view/asterisk?view=rev&rev=75227
Log:
I found this sillyness when I did my ast_module_user conversion. Return immediately if no data was passed to the Verbose application.
Modified:
trunk/apps/app_verbose.c
Modified: trunk/apps/app_verbose.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_verbose.c?view=diff&rev=75227&r1=75226&r2=75227
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Mon Jul 16 10:57:01 2007
@@ -54,39 +54,39 @@
static int verbose_exec(struct ast_channel *chan, void *data)
{
- char *vtext;
+ char *vtext, *tmp;
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;
+ 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);
}
}
More information about the asterisk-commits
mailing list