[Asterisk-code-review] vector: Additional string vector definitions. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Sun Jan 14 14:58:42 CST 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/7871 )

Change subject: vector: Additional string vector definitions.
......................................................................


Patch Set 5: Code-Review-1

(4 comments)

https://gerrit.asterisk.org/#/c/7871/5/include/asterisk/vector.h
File include/asterisk/vector.h:

https://gerrit.asterisk.org/#/c/7871/5/include/asterisk/vector.h@69
PS5, Line 69: int ast_vector_string_split(struct ast_vector_string *dest,
Return value meaning?


https://gerrit.asterisk.org/#/c/7871/5/main/strings.c
File main/strings.c:

https://gerrit.asterisk.org/#/c/7871/5/main/strings.c@407
PS5, Line 407: 	ast_assert(dest != NULL);
The dest and delim asserts should be done the first thing in the function.  They are checking/declaring constraints of the parameters.


https://gerrit.asterisk.org/#/c/7871/5/main/strings.c@408
PS5, Line 408: 	ast_assert(buf != NULL);
buf can never be NULL from ast_strdupa() because buf was allocated from the stack.  Blowing the stack is unrecoverable.


https://gerrit.asterisk.org/#/c/7871/5/main/strings.c@411
PS5, Line 411: 	while ((cur = strsep(&buf, delim))) {
             : 		if (excludes_cmp && AST_VECTOR_GET_CMP(dest, cur, !excludes_cmp)) {
A potential option is to ast_strip() blanks and skip empty strings.  This way you could use the function to parse comma separated lists that include spaces:
alice, bob, charlie

It does depend on the purpose of this function and the increased interface complexity if it is worth adding.



-- 
To view, visit https://gerrit.asterisk.org/7871
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I1bf02a1efeb2baeea11c59c557d39dd1197494d7
Gerrit-Change-Number: 7871
Gerrit-PatchSet: 5
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Sun, 14 Jan 2018 20:58:42 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180114/cee7f1d1/attachment.html>


More information about the asterisk-code-review mailing list