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

Richard Mudgett asteriskteam at digium.com
Sun Jan 14 17:47:09 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:

(1 comment)

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

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)) {
> The current purpose of this function is to parse the module dependencies (s
The strip and empty string skip functionality would be:

while ((cur = strsep(&buf, delim))) {
  cur = ast_strip(cur);
  if (!ast_strlen_zero(cur)) {
     continue;
  }
  ...
}

Yes a flags argument would do to express the optional functionality.

I was thinking of two options really:

1) Strip blanks from the delimited strings.  Stripping blanks from the strings could be made non-optional as there are few cases where it would be desirable to not strip leading and trailing blanks.

2) Ignore empty delimited strings.  Skipping empty strings is the more optional functionality that would be desired.  Sometimes you may want things by position even if they are empty.

alice, , bob, charlie

Actually implementing these options with a flags parameter is fairly cheap.  Simply test if the flag bit is set and do or not do the option.

I think it should be added.  The pjsip_configuration.c:ident_handler() nearly implements this very function.  In the future it may actually use it if we ever allow dynamically added identifier names for the endpoint identify_by configuration option.



-- 
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 23:47:09 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180114/0a957ac0/attachment.html>


More information about the asterisk-code-review mailing list