[asterisk-commits] murf: branch murf/datastructs r82122 - in /team/murf/datastructs: main/ utils/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 10 10:36:08 CDT 2007


Author: murf
Date: Mon Sep 10 10:36:07 2007
New Revision: 82122

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82122
Log:
marta's changes to astobj.c added; some tweaks to the hashtest programs

Modified:
    team/murf/datastructs/main/astobj2.c
    team/murf/datastructs/utils/hashtest.c
    team/murf/datastructs/utils/hashtest2.c

Modified: team/murf/datastructs/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/murf/datastructs/main/astobj2.c?view=diff&rev=82122&r1=82121&r2=82122
==============================================================================
--- team/murf/datastructs/main/astobj2.c (original)
+++ team/murf/datastructs/main/astobj2.c Mon Sep 10 10:36:07 2007
@@ -501,6 +501,7 @@
 {
 	int lim;
 	struct bucket_list *p = NULL;
+	void *ret = NULL;
 
 	if (INTERNAL_OBJ(a->c) == NULL)
 		return NULL;
@@ -541,14 +542,15 @@
 		a->version = p->version;
 		a->obj = p;
 		a->c_version = a->c->version;
+		ret = EXTERNAL_OBJ(p->astobj);
 		/* inc refcount of returned object */
-		ao2_ref(EXTERNAL_OBJ(p->astobj), 1);
+		ao2_ref(ret, 1);
 	}
 
 	if (!(a->flags & F_AO2I_DONTLOCK))
 		ao2_unlock(a->c);
 
-	return p ? EXTERNAL_OBJ(p->astobj) : NULL;
+	return ret;
 }
 
 /* callback for destroying container.

Modified: team/murf/datastructs/utils/hashtest.c
URL: http://svn.digium.com/view/asterisk/team/murf/datastructs/utils/hashtest.c?view=diff&rev=82122&r1=82121&r2=82122
==============================================================================
--- team/murf/datastructs/utils/hashtest.c (original)
+++ team/murf/datastructs/utils/hashtest.c Mon Sep 10 10:36:07 2007
@@ -259,7 +259,7 @@
 	int i, biggest, resize_cnt, numobjs, numbuckets;
 	
 	/* init a single global hashtab, then... */
-	glob_hashtab = ast_hashtab_create(100, hashtab_compare_strings_nocase, ast_hashtab_resize_java, ast_hashtab_newsize_java, hashtab_hash_string_nocase, 1);
+	glob_hashtab = ast_hashtab_create(180000, hashtab_compare_strings_nocase, ast_hashtab_resize_java, ast_hashtab_newsize_java, hashtab_hash_string_nocase, 1);
 	printf("starting with %d elements in the hashtable...\n", ast_hashtab_capacity(glob_hashtab));
 	/* set a random seed  */
 	glob_seed = (unsigned int)time(0);

Modified: team/murf/datastructs/utils/hashtest2.c
URL: http://svn.digium.com/view/asterisk/team/murf/datastructs/utils/hashtest2.c?view=diff&rev=82122&r1=82121&r2=82122
==============================================================================
--- team/murf/datastructs/utils/hashtest2.c (original)
+++ team/murf/datastructs/utils/hashtest2.c Mon Sep 10 10:36:07 2007
@@ -176,7 +176,7 @@
 #ifdef DEBUG
 		printf("...YES (el=%x)\n", (unsigned long)el);
 #endif
-		ao2_unlink(glob_hashtab, el); /* mistakenly tried to use ao2_unref(c,-2) here to unlink. Bad Boy! */
+		ao2_unlink(glob_hashtab, el); /* mistakenly tried to use ao2_ref(c,-2) here to unlink. Bad Boy! */
 		els_removed++;
 	} else {
 #ifdef DEBUG
@@ -274,7 +274,7 @@
 	int i;
 	
 	/* init a single global hashtab, then... */
-	glob_hashtab = ao2_container_alloc(300001, hash_string, hashtab_compare_strings);
+	glob_hashtab = ao2_container_alloc(180000, hash_string, hashtab_compare_strings);
 
 	/* set a random seed  */
 	glob_seed = (unsigned int)time(0);




More information about the asterisk-commits mailing list