[svn-commits] murf: trunk r89196 - in /trunk: include/asterisk/hashtab.h main/hashtab.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 12 14:49:27 CST 2007


Author: murf
Date: Mon Nov 12 14:49:27 2007
New Revision: 89196

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89196
Log:
Thanks to snuff-work, who brought up that these fixes might need to be made.

Modified:
    trunk/include/asterisk/hashtab.h
    trunk/main/hashtab.c

Modified: trunk/include/asterisk/hashtab.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/hashtab.h?view=diff&rev=89196&r1=89195&r2=89196
==============================================================================
--- trunk/include/asterisk/hashtab.h (original)
+++ trunk/include/asterisk/hashtab.h Mon Nov 12 14:49:27 2007
@@ -175,7 +175,7 @@
 int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
 
 	/* same as the above, but h is the hash index; won't hash to find the index */
-int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, int h);
+int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h);
 
 
 	/* check to see if the element is already there; insert only if
@@ -194,7 +194,7 @@
 
 	/* same as the above lookup, but sets h to the key hash value if the lookup fails -- this has the modulus 
        applied, and will not be useful for long term storage if the table is resizable */
-void * ast_hashtab_lookup_bucket(struct ast_hashtab *tab, const void *obj, int *h);
+void * ast_hashtab_lookup_bucket(struct ast_hashtab *tab, const void *obj, unsigned int *h);
 
 	/* returns key stats for the table */
 void ast_hashtab_get_stats( struct ast_hashtab *tab, int *biggest_bucket_size, int *resize_count, int *num_objects, int *num_buckets);

Modified: trunk/main/hashtab.c
URL: http://svn.digium.com/view/asterisk/trunk/main/hashtab.c?view=diff&rev=89196&r1=89195&r2=89196
==============================================================================
--- trunk/main/hashtab.c (original)
+++ trunk/main/hashtab.c Mon Nov 12 14:49:27 2007
@@ -246,7 +246,7 @@
 struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj))
 {
 	struct ast_hashtab *ht = ast_calloc(1,sizeof(struct ast_hashtab));
-	int i;
+	unsigned int i;
 	
 	ht->array = ast_calloc(tab->hash_tab_size,sizeof(struct ast_hashtab_bucket*));
 	ht->hash_tab_size = tab->hash_tab_size;
@@ -416,7 +416,7 @@
 	return 1;
 }
 
-int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, int h)
+int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h)
 {
 	/* normally, you'd insert "safely" by checking to see if the element is
 	   already there; in this case, you must already have checked. If an element
@@ -456,7 +456,7 @@
 	   it is not there. */
 	/* will force a resize if the resize func returns 1 */
 	/* returns 1 on success, 0 if there's a problem, or it's already there. */
-	int bucket = 0;
+	unsigned int bucket = 0;
 	if (tab->do_locking)
 		ast_rwlock_wrlock(&tab->lock);
 
@@ -525,7 +525,7 @@
 	return 0;
 }
 
-void * ast_hashtab_lookup_bucket(struct ast_hashtab *tab, const void *obj, int *bucket)
+void * ast_hashtab_lookup_bucket(struct ast_hashtab *tab, const void *obj, unsigned int *bucket)
 {
 	/* lookup this object in the hash table. return a ptr if found, or NULL if not */
 	unsigned int h;




More information about the svn-commits mailing list