summaryrefslogtreecommitdiff
path: root/res/res_pjsip/location.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2015-01-06 17:28:40 +0000
committerGeorge Joseph <george.joseph@fairview5.com>2015-01-06 17:28:40 +0000
commitd873b09075bbcc584b936ec1f46e0f58c7ec7279 (patch)
tree7dc5ea6c4cf1d2bb59a6970cd01f4b3899cceef9 /res/res_pjsip/location.c
parent566907fabd6acfd20f59145044649991af23d976 (diff)
pjsip cli: Fix sorting of contacts for 'pjsip list contacts'
For some reason I was using a hash container instead of a list to gather the contacts for 'pjsip list/show contacts' so even though I had a sort function, the output wasn't sorted. This patch just changes the hash container to a list container and the contacts now appear sorted in the CLI. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4305/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r--res/res_pjsip/location.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 6ffb8fec3..f36235161 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -643,18 +643,6 @@ static int cli_contact_compare(void *obj, void *arg, int flags)
return cmp;
}
-static int cli_contact_hash(const void *obj, int flags)
-{
- const struct ast_sip_contact_wrapper *wrapper = obj;
- if (flags & OBJ_SEARCH_OBJECT) {
- return ast_str_hash(wrapper->contact_id);
- } else if (flags & OBJ_SEARCH_KEY) {
- return ast_str_hash(obj);
- }
-
- return -1;
-}
-
static int cli_contact_iterate(void *container, ao2_callback_fn callback, void *args)
{
return ast_sip_for_each_contact(container, callback, args);
@@ -670,8 +658,8 @@ static struct ao2_container *cli_contact_get_container(void)
return NULL;
}
- child_container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, 17,
- cli_contact_hash, cli_contact_sort, cli_contact_compare);
+ child_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,
+ cli_contact_sort, cli_contact_compare);
if (!child_container) {
return NULL;
}