[Asterisk-code-review] stasis.c: Added topic all container (asterisk[master])

Corey Farrell asteriskteam at digium.com
Mon Jan 28 10:38:20 CST 2019


Corey Farrell has posted comments on this change. ( https://gerrit.asterisk.org/10929 )

Change subject: stasis.c: Added topic_all container
......................................................................


Patch Set 7: Code-Review-1

(4 comments)

https://gerrit.asterisk.org/#/c/10929/7/main/stasis.c
File main/stasis.c:

https://gerrit.asterisk.org/#/c/10929/7/main/stasis.c@2228
PS7, Line 2228: 				NULL, topic_proxy_name_cmp);
topic_proxy_cmp_fn should be used for the cmp function, just remove the topic_proxy_name_cmp function.  Also you need to provide a sort callback (that's the whole point of using the _list allocator).

I suggest adding AO2_STRING_FIELD_CASE_SORT_FN(topic_proxy, name); to generate topic_proxy_sort_fn.  This works differently from the _cmp_fn as it directly returns the result of strcasecmp.


https://gerrit.asterisk.org/#/c/10929/7/main/stasis.c@2230
PS7, Line 2230: 	if (ao2_container_dup(tmp_container, topic_all, OBJ_SEARCH_OBJECT)) {
ao2_container_dup is not NULL safe, need to use:
if (!tmp_container || ao2_container_dup(tmp_container, topic_all, OBJ_SEARCH_OBJECT)) {


https://gerrit.asterisk.org/#/c/10929/7/main/stasis.c@2238
PS7, Line 2238: 	while ((topic = ao2_iterator_next(&iter))) {
I'm sorry I wasn't quite clear in my previous comment.  You still need to unref topic.  The extra ref/unref that is being avoided is internal to tmp_container.


https://gerrit.asterisk.org/#/c/10929/7/main/stasis.c@2267
PS7, Line 2267: 		if (!strncasecmp(word, topic->name, wordlen) && ++which > state) {
You missed my comment here, can you remove which and state from this function?



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie86d125d2966f93de74ee00f47ae6fbc8c081c5f
Gerrit-Change-Number: 10929
Gerrit-PatchSet: 7
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: sungtae kim <pchero21 at gmail.com>
Gerrit-Comment-Date: Mon, 28 Jan 2019 16:38:20 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190128/c0d58c66/attachment.html>


More information about the asterisk-code-review mailing list