Minor clean up. Constify a few variables and use ast_strlen_zero in a few places.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2007-06-04 17:32:41 +00:00
parent 2f25292c60
commit d84f78ac04

View File

@@ -90,7 +90,7 @@ static int can_pickup(struct ast_channel *chan)
} }
/* Attempt to pick up specified extension with context */ /* Attempt to pick up specified extension with context */
static int pickup_by_exten(struct ast_channel *chan, char *exten, char *context) static int pickup_by_exten(struct ast_channel *chan, const char *exten, const char *context)
{ {
int res = -1; int res = -1;
struct ast_channel *target = NULL; struct ast_channel *target = NULL;
@@ -110,7 +110,7 @@ static int pickup_by_exten(struct ast_channel *chan, char *exten, char *context)
} }
/* Attempt to pick up specified mark */ /* Attempt to pick up specified mark */
static int pickup_by_mark(struct ast_channel *chan, char *mark) static int pickup_by_mark(struct ast_channel *chan, const char *mark)
{ {
int res = -1; int res = -1;
const char *tmp = NULL; const char *tmp = NULL;
@@ -149,11 +149,11 @@ static int pickup_exec(struct ast_channel *chan, void *data)
while (!ast_strlen_zero(tmp) && (exten = strsep(&tmp, "&"))) { while (!ast_strlen_zero(tmp) && (exten = strsep(&tmp, "&"))) {
if ((context = strchr(exten, '@'))) if ((context = strchr(exten, '@')))
*context++ = '\0'; *context++ = '\0';
if (context && !strcasecmp(context, PICKUPMARK)) { if (!ast_strlen_zero(context) && !strcasecmp(context, PICKUPMARK)) {
if (!pickup_by_mark(chan, exten)) if (!pickup_by_mark(chan, exten))
break; break;
} else { } else {
if (!pickup_by_exten(chan, exten, context ? context : chan->context)) if (!pickup_by_exten(chan, exten, !ast_strlen_zero(context) ? context : chan->context))
break; break;
} }
ast_log(LOG_NOTICE, "No target channel found for %s.\n", exten); ast_log(LOG_NOTICE, "No target channel found for %s.\n", exten);