Change strlen calls to ast_strlen_zero in voicemail checking stuff because it is called all the time

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
James Golovich
2004-05-03 04:37:03 +00:00
parent 0e89f839e1
commit 5537e1ad17

9
app.c
View File

@@ -27,6 +27,7 @@
#include <asterisk/dsp.h> #include <asterisk/dsp.h>
#include <asterisk/logger.h> #include <asterisk/logger.h>
#include <asterisk/options.h> #include <asterisk/options.h>
#include <asterisk/utils.h>
#include "asterisk.h" #include "asterisk.h"
#include "astconf.h" #include "astconf.h"
@@ -153,14 +154,14 @@ int ast_app_has_voicemail(const char *mailbox)
char *context; char *context;
int ret; int ret;
/* If no mailbox, return immediately */ /* If no mailbox, return immediately */
if (!strlen(mailbox)) if (ast_strlen_zero(mailbox))
return 0; return 0;
if (strchr(mailbox, ',')) { if (strchr(mailbox, ',')) {
strncpy(tmp, mailbox, sizeof(tmp)); strncpy(tmp, mailbox, sizeof(tmp));
mb = tmp; mb = tmp;
ret = 0; ret = 0;
while((cur = strsep(&mb, ","))) { while((cur = strsep(&mb, ","))) {
if (strlen(cur)) { if (!ast_strlen_zero(cur)) {
if (ast_app_has_voicemail(cur)) if (ast_app_has_voicemail(cur))
return 1; return 1;
} }
@@ -202,7 +203,7 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
if (oldmsgs) if (oldmsgs)
*oldmsgs = 0; *oldmsgs = 0;
/* If no mailbox, return immediately */ /* If no mailbox, return immediately */
if (!strlen(mailbox)) if (ast_strlen_zero(mailbox))
return 0; return 0;
if (strchr(mailbox, ',')) { if (strchr(mailbox, ',')) {
int tmpnew, tmpold; int tmpnew, tmpold;
@@ -210,7 +211,7 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
mb = tmp; mb = tmp;
ret = 0; ret = 0;
while((cur = strsep(&mb, ", "))) { while((cur = strsep(&mb, ", "))) {
if (strlen(cur)) { if (!ast_strlen_zero(cur)) {
if (ast_app_messagecount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL)) if (ast_app_messagecount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL))
return -1; return -1;
else { else {