Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
68bb6ef6
Commit
68bb6ef6
authored
6 years ago
by
George Joseph
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "sounds: Sort 'core show sounds' output"
parents
5a2a7d65
f174eb4a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/sounds.c
+17
-1
17 additions, 1 deletion
main/sounds.c
with
17 additions
and
1 deletion
main/sounds.c
+
17
−
1
View file @
68bb6ef6
...
...
@@ -135,6 +135,11 @@ static int show_sound_info_cb(void *obj, void *arg, void *data, int flags)
return
0
;
}
static
int
sound_sorter
(
const
void
*
obj_left
,
const
void
*
obj_right
,
int
flags
)
{
return
strcmp
(
obj_left
,
obj_right
);
}
/*! \brief Show a list of sounds available on the system */
static
char
*
handle_cli_sounds_show
(
struct
ast_cli_entry
*
e
,
int
cmd
,
struct
ast_cli_args
*
a
)
{
...
...
@@ -152,6 +157,7 @@ static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast
if
(
a
->
argc
==
3
)
{
struct
ast_media_index
*
sounds_index
=
ast_sounds_get_index
();
struct
ao2_container
*
sound_files
;
struct
ao2_container
*
sorted
;
if
(
!
sounds_index
)
{
return
CLI_FAILURE
;
...
...
@@ -163,8 +169,18 @@ static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast
return
CLI_FAILURE
;
}
sorted
=
ao2_container_alloc_rbtree
(
AO2_ALLOC_OPT_LOCK_NOLOCK
,
0
,
sound_sorter
,
NULL
);
if
(
!
sorted
||
ao2_container_dup
(
sorted
,
sound_files
,
0
))
{
ao2_cleanup
(
sorted
);
ao2_cleanup
(
sound_files
);
return
CLI_FAILURE
;
}
ast_cli
(
a
->
fd
,
"Available audio files:
\n
"
);
ao2_callback
(
sound_files
,
OBJ_MULTIPLE
|
OBJ_NODATA
,
show_sounds_cb
,
a
);
ao2_callback
(
sorted
,
OBJ_MULTIPLE
|
OBJ_NODATA
,
show_sounds_cb
,
a
);
ao2_ref
(
sorted
,
-
1
);
ao2_ref
(
sound_files
,
-
1
);
return
CLI_SUCCESS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment