[svn-commits] murf: branch murf/fast-ast r47190 - /team/murf/fast-ast/main/hashtab.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Nov 4 08:26:50 MST 2006


Author: murf
Date: Sat Nov  4 09:26:49 2006
New Revision: 47190

URL: http://svn.digium.com/view/asterisk?rev=47190&view=rev
Log:
move the make-prime up to avoid problems

Modified:
    team/murf/fast-ast/main/hashtab.c

Modified: team/murf/fast-ast/main/hashtab.c
URL: http://svn.digium.com/view/asterisk/team/murf/fast-ast/main/hashtab.c?rev=47190&r1=47189&r2=47190&view=diff
==============================================================================
--- team/murf/fast-ast/main/hashtab.c (original)
+++ team/murf/fast-ast/main/hashtab.c Sat Nov  4 09:26:49 2006
@@ -106,7 +106,6 @@
 	int i = (tab->hash_tab_size<<1); /* multiply by two */
 	while (!isPrime(i))
 		i++;
-	printf("newsize: chose %d\n", i);
 	return i;
 }
 
@@ -176,9 +175,9 @@
 										int do_locking ) /* use locks to guarantee safety of iterators/insertion/deletion */
 {
 	struct ast_hashtab *ht = (struct ast_hashtab *)calloc(1,sizeof(struct ast_hashtab));
-	ht->array = (struct ast_hashtab_bucket **)calloc(initial_buckets,sizeof(struct ast_hashtab_bucket*));
 	while (!isPrime(initial_buckets)) /* make sure this is prime */
 		initial_buckets++;
+	ht->array = (struct ast_hashtab_bucket **)calloc(initial_buckets,sizeof(struct ast_hashtab_bucket*));
 	ht->hash_tab_size = initial_buckets;
 	ht->compare = compare;
 	ht->resize = resize;
@@ -397,7 +396,6 @@
 
 	if (!tab || !obj)
 		return 0;
-
 	last = 0;
 	h = (*tab->hash)(obj, tab->hash_tab_size);
 	for(b=tab->array[h]; b; b=b->next)
@@ -429,7 +427,7 @@
 
 	if (!tab || !obj)
 		return 0;
-
+ 
 	last = 0;
 	h = (*tab->hash)(obj, tab->hash_tab_size);
 	for (b=tab->array[h]; b; b=b->next)



More information about the svn-commits mailing list