[Asterisk-code-review] app voicemail: Remove need to subscribe to stasis (asterisk[13])

Sean Bright asteriskteam at digium.com
Mon Sep 17 17:38:49 CDT 2018


Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/10132 )

Change subject: app_voicemail: Remove need to subscribe to stasis
......................................................................


Patch Set 6: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/10132/6/apps/app_voicemail.c
File apps/app_voicemail.c:

https://gerrit.asterisk.org/#/c/10132/6/apps/app_voicemail.c@12195
PS6, Line 12195: 	char *mailbox;
               : 
               : 	if (!ast_strlen_zero(vmu->mailbox)) {
               : 		len += strlen(vmu->mailbox);
               : 	}
               : 
               : 	if (!ast_strlen_zero(vmu->context)) {
               : 		len += strlen(vmu->context) + 1; /* Allow for seperator and terminator */
               : 	}
               : 
               : 	mailbox = ast_alloca(len);
               : 	if (!ast_strlen_zero(vmu->mailbox)) {
               : 		strcpy(mailbox, vmu->mailbox); /* Safe */
               : 	}
               : 
               : 	if (!ast_strlen_zero(vmu->context)) {
               : 		strcat(mailbox, "@");  /* Safe */
               : 		strcat(mailbox, vmu->context);  /* Safe */
               : 	}
               : 
               : 	if (ast_strlen_zero(mailbox)) {
               : 		ast_log(LOG_ERROR, "Mailbox can't be empty\n");
               : 		return -1;
               : 	}
I may not be understanding something, but this seems unnecessarily complicated. Wouldn't something like this work?

 char mailbox[AST_MAX_CONTEXT + AST_MAX_EXTENSION + sizeof("@")];

 snprintf(mailbox, sizeof(mailbox), "%s@%s", vmu->mailbox, vmu->context);

 if (!strcmp(mailbox, "@")) {
	ast_log(LOG_ERROR, "Mailbox can't be empty\n");
	return -1;
 }



-- 
To view, visit https://gerrit.asterisk.org/10132
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I5cceb737246949f9782955c64425b8bd25a9e9ee
Gerrit-Change-Number: 10132
Gerrit-PatchSet: 6
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Comment-Date: Mon, 17 Sep 2018 22:38:49 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180917/f45029f0/attachment-0001.html>


More information about the asterisk-code-review mailing list