<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10955">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit

</div><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;"><span>diff --git a/main/sounds.c b/main/sounds.c</span><br><span>index 091a396..c3323da 100644</span><br><span>--- a/main/sounds.c</span><br><span>+++ b/main/sounds.c</span><br><span>@@ -135,6 +135,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>@@ -152,6 +157,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>@@ -163,8 +169,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_rbtree(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/10955">change 10955</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/10955"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib39052a745040f75eb635f15a042da15b20e22ab </div>
<div style="display:none"> Gerrit-Change-Number: 10955 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>