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
cd741136
Commit
cd741136
authored
7 years ago
by
Jenkins2
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "pjsip: Improve CLI completion performance"
parents
6d25b269
521f741b
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
res/res_pjsip/pjsip_cli.c
+8
-16
8 additions, 16 deletions
res/res_pjsip/pjsip_cli.c
with
8 additions
and
16 deletions
res/res_pjsip/pjsip_cli.c
+
8
−
16
View file @
cd741136
...
...
@@ -82,31 +82,22 @@ int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
return
0
;
}
static
char
*
complete_show_sorcery_object
(
struct
ao2_container
*
container
,
static
void
complete_show_sorcery_object
(
struct
ao2_container
*
container
,
struct
ast_sip_cli_formatter_entry
*
formatter_entry
,
const
char
*
word
,
int
state
)
const
char
*
word
)
{
char
*
result
=
NULL
;
int
wordlen
=
strlen
(
word
);
int
which
=
0
;
struct
ao2_iterator
i
=
ao2_iterator_init
(
container
,
0
);
size_t
wordlen
=
strlen
(
word
);
void
*
object
;
struct
ao2_iterator
i
=
ao2_iterator_init
(
container
,
0
);
while
((
object
=
ao2_t_iterator_next
(
&
i
,
"iterate thru endpoints table"
)))
{
const
char
*
id
=
formatter_entry
->
get_id
(
object
);
if
(
!
strncasecmp
(
word
,
id
,
wordlen
)
&&
++
which
>
state
)
{
result
=
ast_strdup
(
id
);
if
(
!
strncasecmp
(
word
,
id
,
wordlen
))
{
ast_cli_completion_add
(
ast_strdup
(
id
));
}
ao2_t_ref
(
object
,
-
1
,
"toss iterator endpoint ptr before break"
);
if
(
result
)
{
break
;
}
}
ao2_iterator_destroy
(
&
i
);
return
result
;
}
static
void
dump_str_and_free
(
int
fd
,
struct
ast_str
*
buf
)
...
...
@@ -211,7 +202,8 @@ char *ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_
if
(
cmd
==
CLI_GENERATE
)
{
ast_free
(
context
.
output_buffer
);
return
complete_show_sorcery_object
(
container
,
formatter_entry
,
a
->
word
,
a
->
n
);
complete_show_sorcery_object
(
container
,
formatter_entry
,
a
->
word
);
return
NULL
;
}
if
(
is_container
)
{
...
...
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