[asterisk-commits] gtjoseph: trunk r430222 - in /trunk: ./ res/res_pjsip/location.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 6 11:29:37 CST 2015


Author: gtjoseph
Date: Tue Jan  6 11:29:33 2015
New Revision: 430222

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430222
Log:
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/
........

Merged revisions 430221 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip/location.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/res/res_pjsip/location.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/location.c?view=diff&rev=430222&r1=430221&r2=430222
==============================================================================
--- trunk/res/res_pjsip/location.c (original)
+++ trunk/res/res_pjsip/location.c Tue Jan  6 11:29:33 2015
@@ -643,18 +643,6 @@
 	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 @@
 		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;
 	}




More information about the asterisk-commits mailing list