diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 10:51:31 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-04-21 10:51:31 +0000 |
commit | 652ccf50375f363cfbda3a0a7016e13d81900f04 (patch) | |
tree | 861d327cfba347b56fcdbd4274db009064994907 /funcs/func_callerid.c | |
parent | 4cef4ef720fa327bd37e305789b1fe2874901dea (diff) |
more NULL "" equivalence in CLI fields.
Mark a place where we don't clear a buffer while we probably should.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_callerid.c')
-rw-r--r-- | funcs/func_callerid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c index e87ed11a7..03a653579 100644 --- a/funcs/func_callerid.c +++ b/funcs/func_callerid.c @@ -42,6 +42,7 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data, { char *opt = data; + /* XXX we are not always clearing the buffer. Is this correct ? */ if (strchr(opt, '|')) { char name[80], num[80]; @@ -62,8 +63,8 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data, } else { if (!strncasecmp("all", data, 3)) { snprintf(buf, len, "\"%s\" <%s>", - chan->cid.cid_name ? chan->cid.cid_name : "", - chan->cid.cid_num ? chan->cid.cid_num : ""); + S_OR(chan->cid.cid_name, ""), + S_OR(chan->cid.cid_num, "")); } else if (!strncasecmp("name", data, 4)) { if (chan->cid.cid_name) { ast_copy_string(buf, chan->cid.cid_name, len); @@ -116,12 +117,12 @@ static int callerid_write(struct ast_channel *chan, char *cmd, char *data, /* do we need to lock chan here? */ if (chan->cid.cid_dnid) free(chan->cid.cid_dnid); - chan->cid.cid_dnid = ast_strlen_zero(value) ? NULL : strdup(value); + chan->cid.cid_dnid = ast_strdup(value); } else if (!strncasecmp("rdnis", data, 5)) { /* do we need to lock chan here? */ if (chan->cid.cid_rdnis) free(chan->cid.cid_rdnis); - chan->cid.cid_rdnis = ast_strlen_zero(value) ? NULL : strdup(value); + chan->cid.cid_rdnis = ast_strdup(value); } else { ast_log(LOG_ERROR, "Unknown callerid data type.\n"); } |