[Asterisk-code-review] sounds index: Avoid repeatedly reindexing. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Wed Dec 6 17:25:29 CST 2017


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

Change subject: sounds_index: Avoid repeatedly reindexing.
......................................................................


Patch Set 3: Code-Review-1

(3 comments)

https://gerrit.asterisk.org/#/c/7454/3/main/asterisk.c
File main/asterisk.c:

https://gerrit.asterisk.org/#/c/7454/3/main/asterisk.c@4645
PS3, Line 4645: 	ast_sounds_reindex();
check_init(ast_sounds_reindex(), "First sounds index");


https://gerrit.asterisk.org/#/c/7454/3/main/sounds_index.c
File main/sounds_index.c:

https://gerrit.asterisk.org/#/c/7454/3/main/sounds_index.c@299
PS3, Line 299: 	if (ast_sounds_reindex()) {
             : 		return -1;
             : 	}
We can get away with not indexing the sounds now.  Otherwise we will always index the sounds twice.  Once here and once just before fully booted.

show_sound_info_cb() is the only place that doesn't check for a NULL after calling ast_sounds_get_index().  This is done for a CLI command so it doesn't really matter much.

The other places that call ast_sounds_get_index() are for ARI.  Those places check for a NULL return value and I don't think we even allow ARI activity until fully booted anyway.


https://gerrit.asterisk.org/#/c/7454/3/main/sounds_index.c@335
PS3, Line 335: 	ao2_ref(sounds_index, +1);
             : 	return sounds_index;
Heh.  ast_sounds_get_index() documents it returns NULL on failure but we'll crash instead. :)

return ao2_bump(sounds_index);



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I585fd6ee04200612ab1490dc804f76805f89cf0a
Gerrit-Change-Number: 7454
Gerrit-PatchSet: 3
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 06 Dec 2017 23:25:29 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171206/3e5ebbd2/attachment-0001.html>


More information about the asterisk-code-review mailing list