<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10953">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sounds: Sort 'core show sounds' output<br><br>Change-Id: Ib39052a745040f75eb635f15a042da15b20e22ab<br>---<br>M main/sounds.c<br>1 file changed, 17 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/53/10953/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/sounds.c b/main/sounds.c</span><br><span>index 2dd86b5..209f7fb 100644</span><br><span>--- a/main/sounds.c</span><br><span>+++ b/main/sounds.c</span><br><span>@@ -140,6 +140,11 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static int sound_sorter(const void *obj_left, const void *obj_right, int flags)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ return strcmp(obj_left, obj_right);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \brief Show a list of sounds available on the system */</span><br><span> static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span> {</span><br><span>@@ -157,6 +162,7 @@</span><br><span> if (a->argc == 3) {</span><br><span> struct ast_media_index *sounds_index = ast_sounds_get_index();</span><br><span> struct ao2_container *sound_files;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ao2_container *sorted;</span><br><span> </span><br><span> if (!sounds_index) {</span><br><span> return CLI_FAILURE;</span><br><span>@@ -168,8 +174,18 @@</span><br><span> return CLI_FAILURE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ sorted = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ sound_sorter, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!sorted</span><br><span style="color: hsl(120, 100%, 40%);">+ || ao2_container_dup(sorted, sound_files, 0)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_cleanup(sorted);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_cleanup(sound_files);</span><br><span style="color: hsl(120, 100%, 40%);">+ return CLI_FAILURE;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_cli(a->fd, "Available audio files:\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_callback(sound_files, OBJ_MULTIPLE | OBJ_NODATA, show_sounds_cb, a);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_callback(sorted, OBJ_MULTIPLE | OBJ_NODATA, show_sounds_cb, a);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(sorted, -1);</span><br><span> ao2_ref(sound_files, -1);</span><br><span> </span><br><span> return CLI_SUCCESS;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10953">change 10953</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10953"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ib39052a745040f75eb635f15a042da15b20e22ab </div>
<div style="display:none"> Gerrit-Change-Number: 10953 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>