summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Golovich <james@gnuinter.net>2004-05-08 08:07:47 +0000
committerJames Golovich <james@gnuinter.net>2004-05-08 08:07:47 +0000
commit29718a5001327d7487481a621616ad77d25aba72 (patch)
treea623ef4c57358b84f6ee14266ae684153cd38f4c
parent0ce20fea8ae8722d521729accaa5ea612f4a8564 (diff)
ast_strlen_zero changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xapps/app_macro.c7
-rwxr-xr-xapps/app_zapbarge.c3
-rwxr-xr-xcdr/cdr_csv.c3
-rwxr-xr-xpbx/pbx_spool.c9
4 files changed, 13 insertions, 9 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 3189d077b..781217337 100755
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -18,6 +18,7 @@
#include <asterisk/pbx.h>
#include <asterisk/module.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -73,14 +74,14 @@ static int macro_exec(struct ast_channel *chan, void *data)
char *save_macro_priority;
char *save_macro_offset;
- if (!data || !strlen(data)) {
+ if (!data || ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Invalid Macro incantation\n");
return 0;
}
strncpy(tmp, data, sizeof(tmp) - 1);
rest = tmp;
macro = strsep(&rest, "|");
- if (!macro || !strlen(macro)) {
+ if (!macro || ast_strlen_zero(macro)) {
ast_log(LOG_WARNING, "Invalid macro name specified\n");
return 0;
}
@@ -96,7 +97,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
oldpriority = chan->priority;
strncpy(oldexten, chan->exten, sizeof(oldexten) - 1);
strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
- if (!strlen(chan->macrocontext)) {
+ if (ast_strlen_zero(chan->macrocontext)) {
strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
strncpy(chan->macroexten, chan->exten, sizeof(chan->macroexten) - 1);
chan->macropriority = chan->priority;
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index 0b865df5b..1dd9dd3bc 100755
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -25,6 +25,7 @@
#include <asterisk/options.h>
#include <asterisk/cli.h>
#include <asterisk/say.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
@@ -246,7 +247,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
int confno = 0;
char confstr[80];
- if (data && strlen(data)) {
+ if (data && !ast_strlen_zero(data)) {
if ((sscanf(data, "Zap/%d", &confno) != 1) &&
(sscanf(data, "%d", &confno) != 1)) {
ast_log(LOG_WARNING, "ZapBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data);
diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c
index c669652be..17a0f4dab 100755
--- a/cdr/cdr_csv.c
+++ b/cdr/cdr_csv.c
@@ -19,6 +19,7 @@
#include <asterisk/cdr.h>
#include <asterisk/module.h>
#include <asterisk/logger.h>
+#include <asterisk/utils.h>
#include "../asterisk.h"
#include "../astconf.h"
@@ -224,7 +225,7 @@ static int csv_log(struct ast_cdr *cdr)
fclose(mf);
mf = NULL;
}
- if (strlen(cdr->accountcode)) {
+ if (!ast_strlen_zero(cdr->accountcode)) {
if (writefile(buf, cdr->accountcode))
ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s'\n", cdr->accountcode);
}
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 1dbee19db..b2a90c68b 100755
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -18,6 +18,7 @@
#include <asterisk/pbx.h>
#include <asterisk/module.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <pthread.h>
#include <sys/stat.h>
#include <errno.h>
@@ -109,9 +110,9 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
*c = '\0';
/* Trim trailing white space */
- while(strlen(buf) && buf[strlen(buf) - 1] < 33)
+ while(!ast_strlen_zero(buf) && buf[strlen(buf) - 1] < 33)
buf[strlen(buf) - 1] = '\0';
- if (strlen(buf)) {
+ if (!ast_strlen_zero(buf)) {
c = strchr(buf, ':');
if (c) {
*c = '\0';
@@ -187,7 +188,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
}
}
strncpy(o->fn, fn, sizeof(o->fn) - 1);
- if (!strlen(o->tech) || !strlen(o->dest) || (!strlen(o->app) && !strlen(o->exten))) {
+ if (ast_strlen_zero(o->tech) || ast_strlen_zero(o->dest) || (ast_strlen_zero(o->app) && ast_strlen_zero(o->exten))) {
ast_log(LOG_WARNING, "At least one of app or extension must be specified, along with tech and dest in file %s\n", fn);
return -1;
}
@@ -219,7 +220,7 @@ static void *attempt_thread(void *data)
{
struct outgoing *o = data;
int res, reason;
- if (strlen(o->app)) {
+ if (!ast_strlen_zero(o->app)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->callerid, o->variable, o->account);