Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv18000
Modified Files:
app.c asterisk.c callerid.c cdr.c config.c db.c dnsmgr.c
file.c manager.c pbx.c utils.c
Log Message:
change ast_strlen_zero to also check for the string to be defined
Index: app.c
===================================================================
RCS file: /usr/cvsroot/asterisk/app.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- app.c 26 Oct 2005 15:02:23 -0000 1.78
+++ app.c 26 Oct 2005 18:54:24 -0000 1.79
@@ -393,7 +393,7 @@
int res = -1;
int autoclose = 0;
if (fd < 0) {
- if (!filename || ast_strlen_zero(filename))
+ if (ast_strlen_zero(filename))
return -1;
autoclose = 1;
if (filename[0] == '/')
@@ -998,7 +998,7 @@
char tmp[256];
char *grp=NULL, *cat=NULL;
- if (data && !ast_strlen_zero(data)) {
+ if (!ast_strlen_zero(data)) {
ast_copy_string(tmp, data, sizeof(tmp));
grp = tmp;
cat = strchr(tmp, '@');
@@ -1008,7 +1008,7 @@
}
}
- if (grp && !ast_strlen_zero(grp))
+ if (!ast_strlen_zero(grp))
ast_copy_string(group, grp, group_max);
else
res = -1;
@@ -1043,10 +1043,10 @@
char cat[80];
char *s;
- if (group == NULL || ast_strlen_zero(group))
+ if (ast_strlen_zero(group))
return 0;
- s = (category && !ast_strlen_zero(category)) ? category :
GROUP_CATEGORY_PREFIX;
+ s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
ast_copy_string(cat, s, sizeof(cat));
chan = NULL;
@@ -1069,14 +1069,14 @@
char cat[80];
char *s;
- if (!groupmatch || ast_strlen_zero(groupmatch))
+ if (ast_strlen_zero(groupmatch))
return 0;
/* if regex compilation fails, return zero matches */
if (regcomp(®exbuf, groupmatch, REG_EXTENDED | REG_NOSUB))
return 0;
- s = (category && !ast_strlen_zero(category)) ? category :
GROUP_CATEGORY_PREFIX;
+ s = (!ast_strlen_zero(category)) ? category : GROUP_CATEGORY_PREFIX;
ast_copy_string(cat, s, sizeof(cat));
chan = NULL;
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -d -r1.185 -r1.186
--- asterisk.c 26 Oct 2005 03:58:32 -0000 1.185
+++ asterisk.c 26 Oct 2005 18:54:24 -0000 1.186
@@ -1704,7 +1704,7 @@
for(;;) {
ebuf = (char *)el_gets(el, &num);
- if (ebuf && !ast_strlen_zero(ebuf)) {
+ if (!ast_strlen_zero(ebuf)) {
if (ebuf[strlen(ebuf)-1] == '\n')
ebuf[strlen(ebuf)-1] = '\0';
if (!remoteconsolehandler(ebuf)) {
Index: callerid.c
===================================================================
RCS file: /usr/cvsroot/asterisk/callerid.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- callerid.c 24 Oct 2005 20:12:04 -0000 1.37
+++ callerid.c 26 Oct 2005 18:54:24 -0000 1.38
@@ -429,7 +429,7 @@
tm.tm_mday, tm.tm_hour, tm.tm_min);
size -= res;
ptr += res;
- if (!number || ast_strlen_zero(number) || (flags & CID_UNKNOWN_NUMBER))
{
+ if (ast_strlen_zero(number) || (flags & CID_UNKNOWN_NUMBER)) {
/* Indicate number not known */
res = snprintf(ptr, size, "\004\001O");
size -= res;
@@ -453,7 +453,7 @@
size -= i;
}
- if (!name || ast_strlen_zero(name) || (flags & CID_UNKNOWN_NAME)) {
+ if (ast_strlen_zero(name) || (flags & CID_UNKNOWN_NAME)) {
/* Indicate name not known */
res = snprintf(ptr, size, "\010\001O");
size -= res;
@@ -617,7 +617,7 @@
int ast_isphonenumber(char *n)
{
int x;
- if (!n || ast_strlen_zero(n))
+ if (ast_strlen_zero(n))
return 0;
for (x=0;n[x];x++)
if (!strchr("0123456789*#+", n[x]))
@@ -649,8 +649,7 @@
while(!ast_strlen_zero(instr) && (instr[strlen(instr) -
1] < 33))
instr[strlen(instr) - 1] = '\0';
/* And leading spaces */
- while(**name && (**name < 33))
- (*name)++;
+ *name = ast_skip_blanks(*name);
return 0;
}
} else {
@@ -675,9 +674,9 @@
static int __ast_callerid_generate(unsigned char *buf, char *name, char
*number, int callwaiting, int codec)
{
- if (name && ast_strlen_zero(name))
+ if (ast_strlen_zero(name))
name = NULL;
- if (number && ast_strlen_zero(number))
+ if (ast_strlen_zero(number))
number = NULL;
return callerid_generate(buf, number, name, 0, callwaiting, codec);
}
Index: cdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cdr.c 24 Oct 2005 20:12:04 -0000 1.54
+++ cdr.c 26 Oct 2005 18:54:24 -0000 1.55
@@ -179,7 +179,7 @@
struct ast_var_t *variables;
struct varshead *headp;
- if (!name || ast_strlen_zero(name))
+ if (ast_strlen_zero(name))
return NULL;
while (cdr) {
Index: config.c
===================================================================
RCS file: /usr/cvsroot/asterisk/config.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- config.c 24 Oct 2005 20:12:04 -0000 1.79
+++ config.c 26 Oct 2005 18:54:24 -0000 1.80
@@ -631,11 +631,12 @@
}
if (process_buf) {
char *buf = ast_strip(process_buf);
- if (!ast_strlen_zero(buf))
+ if (!ast_strlen_zero(buf)) {
if (process_text_line(cfg,
&cat, buf, lineno, filename)) {
cfg = NULL;
break;
}
+ }
}
}
}
Index: db.c
===================================================================
RCS file: /usr/cvsroot/asterisk/db.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- db.c 24 Oct 2005 20:12:04 -0000 1.24
+++ db.c 26 Oct 2005 18:54:24 -0000 1.25
@@ -400,8 +400,8 @@
struct ast_db_entry *last = NULL;
struct ast_db_entry *cur, *ret=NULL;
- if (family && !ast_strlen_zero(family)) {
- if (keytree && !ast_strlen_zero(keytree)) {
+ if (!ast_strlen_zero(family)) {
+ if (!ast_strlen_zero(keytree)) {
/* Family and key tree */
snprintf(prefix, sizeof(prefix), "/%s/%s", family,
prefix);
} else {
@@ -557,7 +557,7 @@
return 0;
}
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id);
res = ast_db_get(family, key, tmp, sizeof(tmp));
Index: dnsmgr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/dnsmgr.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dnsmgr.c 24 Oct 2005 20:12:04 -0000 1.9
+++ dnsmgr.c 26 Oct 2005 18:54:24 -0000 1.10
@@ -82,7 +82,7 @@
{
struct ast_dnsmgr_entry *entry;
- if (!name || !result || ast_strlen_zero(name))
+ if (!result || ast_strlen_zero(name))
return NULL;
entry = calloc(1, sizeof(*entry) + strlen(name));
@@ -112,7 +112,7 @@
int ast_dnsmgr_lookup(const char *name, struct in_addr *result, struct
ast_dnsmgr_entry **dnsmgr)
{
- if (!name || ast_strlen_zero(name) || !result || !dnsmgr)
+ if (ast_strlen_zero(name) || !result || !dnsmgr)
return -1;
if (*dnsmgr && !strcasecmp((*dnsmgr)->name, name))
Index: file.c
===================================================================
RCS file: /usr/cvsroot/asterisk/file.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- file.c 24 Oct 2005 20:12:05 -0000 1.79
+++ file.c 26 Oct 2005 18:54:24 -0000 1.80
@@ -489,7 +489,7 @@
if (chan->generator)
ast_deactivate_generator(chan);
}
- if (preflang && !ast_strlen_zero(preflang)) {
+ if (!ast_strlen_zero(preflang)) {
ast_copy_string(filename3, filename, sizeof(filename3));
endpart = strrchr(filename3, '/');
if (endpart) {
@@ -538,7 +538,7 @@
char lang2[MAX_LANGUAGE];
/* XXX H.263 only XXX */
char *fmt = "h263";
- if (preflang && !ast_strlen_zero(preflang)) {
+ if (!ast_strlen_zero(preflang)) {
snprintf(filename2, sizeof(filename2), "%s/%s", preflang,
filename);
fmts = ast_fileexists(filename2, fmt, NULL);
if (fmts < 1) {
@@ -739,7 +739,7 @@
char *c;
char lang2[MAX_LANGUAGE];
int res = -1;
- if (preflang && !ast_strlen_zero(preflang)) {
+ if (!ast_strlen_zero(preflang)) {
/* Insert the language between the last two parts of the path */
ast_copy_string(tmp, filename, sizeof(tmp));
c = strrchr(tmp, '/');
Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- manager.c 26 Oct 2005 13:03:16 -0000 1.129
+++ manager.c 26 Oct 2005 18:54:24 -0000 1.130
@@ -348,7 +348,7 @@
char *id = astman_get_header(m,"ActionID");
ast_cli(s->fd, "Response: Error\r\n");
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
ast_cli(s->fd, "ActionID: %s\r\n",id);
ast_cli(s->fd, "Message: %s\r\n\r\n", error);
}
@@ -358,7 +358,7 @@
char *id = astman_get_header(m,"ActionID");
ast_cli(s->fd, "Response: %s\r\n", resp);
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
ast_cli(s->fd, "ActionID: %s\r\n",id);
if (msg)
ast_cli(s->fd, "Message: %s\r\n\r\n", msg);
@@ -433,7 +433,7 @@
if (x) {
ret = x;
- } else if (!string || ast_strlen_zero(string)) {
+ } else if (ast_strlen_zero(string)) {
ret = -1;
} else if (ast_false(string)) {
ret = 0;
@@ -517,7 +517,7 @@
} else if (ha)
ast_free_ha(ha);
if (!strcasecmp(authtype, "MD5")) {
- if (key && !ast_strlen_zero(key) &&
s->challenge) {
+ if (!ast_strlen_zero(key) &&
s->challenge) {
int x;
int len=0;
char md5key[256] = "";
@@ -584,7 +584,7 @@
char temp[BUFSIZ];
char *id = astman_get_header(m,"ActionID");
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
ast_cli(s->fd, "Response: Success\r\n%s", idText);
ast_mutex_lock(&actionlock);
@@ -729,7 +729,7 @@
ast_mutex_unlock(&c->lock);
ast_cli(s->fd, "Response: Success\r\n"
"Variable: %s\r\nValue: %s\r\n" ,varname,varval2);
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
ast_cli(s->fd, "ActionID: %s\r\n",id);
ast_cli(s->fd, "\r\n");
@@ -748,10 +748,10 @@
char bridge[256];
struct timeval now = ast_tvnow();
long elapsed_seconds=0;
- int all = !name || ast_strlen_zero(name); /* set if we want all
channels */
+ int all = ast_strlen_zero(name); /* set if we want all channels */
astman_send_ack(s, m, "Channel status will follow");
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
if (all)
c = ast_channel_walk_locked(NULL);
@@ -847,7 +847,7 @@
int pi = 0;
int res;
- if (!name || ast_strlen_zero(name)) {
+ if (ast_strlen_zero(name)) {
astman_send_error(s, m, "Channel not specified");
return 0;
}
@@ -898,7 +898,7 @@
char *cmd = astman_get_header(m, "Command");
char *id = astman_get_header(m, "ActionID");
ast_cli(s->fd, "Response: Follows\r\nPrivilege: Command\r\n");
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
ast_cli(s->fd, "ActionID: %s\r\n", id);
/* FIXME: Wedge a ActionID response in here, waiting for later changes
*/
ast_cli_command(s->fd, cmd);
@@ -1037,7 +1037,7 @@
res = -1;
} else {
memset(fast, 0, sizeof(struct fast_originate_helper));
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
snprintf(fast->idtext, sizeof(fast->idtext),
"ActionID: %s\r\n", id);
ast_copy_string(fast->tech, tech, sizeof(fast->tech));
ast_copy_string(fast->data, data, sizeof(fast->data));
@@ -1093,11 +1093,11 @@
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
int ret;
- if (!mailbox || ast_strlen_zero(mailbox)) {
+ if (ast_strlen_zero(mailbox)) {
astman_send_error(s, m, "Mailbox not specified");
return 0;
}
- if (id && !ast_strlen_zero(id))
+ if (!ast_strlen_zero(id))
snprintf(idText,256,"ActionID: %s\r\n",id);
ret = ast_app_has_voicemail(mailbox, NULL);
ast_cli(s->fd, "Response: Success\r\n"
@@ -1125,12 +1125,12 @@
char *id = astman_get_header(m,"ActionID");
char idText[256] = "";
int newmsgs = 0, oldmsgs = 0;
- if (!mailbox || ast_strlen_zero(mailbox)) {
+ if (ast_strlen_zero(mailbox)) {
astman_send_error(s, m, "Mailbox not specified");
return 0;
}
ast_app_messagecount(mailbox, &newmsgs, &oldmsgs);
- if (id && !ast_strlen_zero(id)) {
+ if (!ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
ast_cli(s->fd, "Response: Success\r\n"
@@ -1163,15 +1163,15 @@
char idText[256] = "";
char hint[256] = "";
int status;
- if (!exten || ast_strlen_zero(exten)) {
+ if (ast_strlen_zero(exten)) {
astman_send_error(s, m, "Extension not specified");
return 0;
}
- if (!context || ast_strlen_zero(context))
+ if (ast_strlen_zero(context))
context = "default";
status = ast_extension_state(NULL, context, exten);
ast_get_hint(hint, sizeof(hint) - 1, NULL, 0, NULL, context, exten);
- if (id && !ast_strlen_zero(id)) {
+ if (!ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
ast_cli(s->fd, "Response: Success\r\n"
@@ -1231,7 +1231,7 @@
astman_send_error(s, m, "Missing action in request");
return 0;
}
- if (id && !ast_strlen_zero(id)) {
+ if (!ast_strlen_zero(id)) {
snprintf(idText,256,"ActionID: %s\r\n",id);
}
if (!s->authenticated) {
@@ -1239,7 +1239,7 @@
char *authtype;
authtype = astman_get_header(m, "AuthType");
if (!strcasecmp(authtype, "MD5")) {
- if (!s->challenge ||
ast_strlen_zero(s->challenge))
+ if (ast_strlen_zero(s->challenge))
snprintf(s->challenge,
sizeof(s->challenge), "%d", rand());
ast_mutex_lock(&s->__lock);
ast_cli(s->fd, "Response: Success\r\n"
Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.291
retrieving revision 1.292
diff -u -d -r1.291 -r1.292
--- pbx.c 26 Oct 2005 13:03:16 -0000 1.291
+++ pbx.c 26 Oct 2005 18:54:24 -0000 1.292
@@ -4528,9 +4528,9 @@
if (!chan)
return -1;
- if (context && !ast_strlen_zero(context))
+ if (!ast_strlen_zero(context))
ast_copy_string(chan->context, context, sizeof(chan->context));
- if (exten && !ast_strlen_zero(exten))
+ if (!ast_strlen_zero(exten))
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
if (priority > -1) {
chan->priority = priority;
@@ -4566,8 +4566,8 @@
tmpchan->writeformat = chan->writeformat;
/* Setup proper location */
ast_explicit_goto(tmpchan,
- (context &&
!ast_strlen_zero(context)) ? context : chan->context,
- (exten && !ast_strlen_zero(exten)) ?
exten : chan->exten,
+ (!ast_strlen_zero(context)) ? context
: chan->context,
+ (!ast_strlen_zero(exten)) ? exten :
chan->exten,
priority);
/* Masquerade into temp channel */
@@ -5053,7 +5053,7 @@
chan = ast_channel_alloc(0);
if (chan) {
ast_copy_string(chan->name,
"OutgoingSpoolFailed", sizeof(chan->name));
- if (context &&
!ast_strlen_zero(context))
+ if (!ast_strlen_zero(context))
ast_copy_string(chan->context,
context, sizeof(chan->context));
ast_copy_string(chan->exten, "failed",
sizeof(chan->exten));
chan->priority = 1;
@@ -5142,7 +5142,7 @@
if (locked_channel)
*locked_channel = NULL;
- if (!app || ast_strlen_zero(app)) {
+ if (ast_strlen_zero(app)) {
res = -1;
goto outgoing_app_cleanup;
}
@@ -5496,7 +5496,7 @@
{
char newexten[AST_MAX_EXTENSION];
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_DEBUG, "Ignoring, since there is no prefix to
add\n");
return 0;
}
@@ -5511,7 +5511,7 @@
{
char newexten[AST_MAX_EXTENSION];
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_DEBUG, "Ignoring, since there is no suffix to
add\n");
return 0;
}
@@ -5528,7 +5528,7 @@
char *s, *ts;
struct ast_timing timing;
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "GotoIfTime requires an argument:\n <time
range>|<days of week>|<days of
month>|<months>?[[context|]extension|]priority\n");
return -1;
}
@@ -5556,7 +5556,7 @@
struct ast_app *app;
const char *usage = "ExecIfTime requires an argument:\n <time
range>|<days of week>|<days of month>|<months>?<appname>[|<appargs>]";
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "%s\n", usage);
return -1;
}
@@ -5943,7 +5943,7 @@
int global = 0;
int x;
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Set requires at least one variable
name/value pair.\n");
return 0;
}
@@ -5981,7 +5981,7 @@
char tmp[VAR_BUF_SIZE]="";
char *s;
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to
set\n");
return 0;
}
@@ -6012,7 +6012,7 @@
char *value;
char *stringp = NULL;
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to
set\n");
return 0;
}
@@ -6067,7 +6067,7 @@
int rc;
char *stringp=NULL;
- if (!data || ast_strlen_zero(data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to
check\n");
return 0;
}
@@ -6079,7 +6079,7 @@
branch2=strsep(&stringp,"");
branch = pbx_checkcondition(condition) ? branch1 : branch2;
- if ((branch==NULL) || ast_strlen_zero(branch)) {
+ if (ast_strlen_zero(branch)) {
ast_log(LOG_DEBUG, "Not taking any branch\n");
return(0);
}
@@ -6097,7 +6097,7 @@
char *options = (char *) NULL;
- if (!data || ast_strlen_zero((char *)data)) {
+ if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "SayNumber requires an argument
(number)\n");
return -1;
}
@@ -6387,7 +6387,7 @@
int ipri;
int mode = 0;
- if (!goto_string || ast_strlen_zero(goto_string)) {
+ if (ast_strlen_zero(goto_string)) {
ast_log(LOG_WARNING, "Goto requires an argument (optional
context|optional extension|priority)\n");
return -1;
}
Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- utils.c 26 Oct 2005 17:33:29 -0000 1.78
+++ utils.c 26 Oct 2005 18:54:24 -0000 1.79
@@ -570,7 +570,7 @@
int ast_true(const char *s)
{
- if (!s || ast_strlen_zero(s))
+ if (ast_strlen_zero(s))
return 0;
/* Determine if this is a true value */
@@ -587,7 +587,7 @@
int ast_false(const char *s)
{
- if (!s || ast_strlen_zero(s))
+ if (ast_strlen_zero(s))
return 0;
/* Determine if this is a false value */
_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs