changeset 3906:51db9cedc120 HEAD

size_t -> unsigned int. It's enough.
author Timo Sirainen <tss@iki.fi>
date Tue, 17 Jan 2006 16:03:45 +0200
parents b694c27ad1a8
children fc69c8b9439a
files src/lib/hash.c src/lib/hash.h
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/hash.c	Tue Jan 17 15:51:19 2006 +0200
+++ b/src/lib/hash.c	Tue Jan 17 16:03:45 2006 +0200
@@ -20,9 +20,9 @@
 	pool_t table_pool, node_pool;
 
 	int frozen;
-	size_t initial_size, nodes_count, removed_count;
+	unsigned int initial_size, nodes_count, removed_count;
 
-	size_t size;
+	unsigned int size;
 	struct hash_node *nodes;
 	struct hash_node *free_nodes;
 
@@ -33,7 +33,7 @@
 struct hash_iterate_context {
 	struct hash_table *table;
 	struct hash_node *next;
-	size_t pos;
+	unsigned int pos;
 };
 
 static bool hash_resize(struct hash_table *table, bool grow);
@@ -50,7 +50,7 @@
 }
 
 struct hash_table *
-hash_create(pool_t table_pool, pool_t node_pool, size_t initial_size,
+hash_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
 	    hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb)
 {
 	struct hash_table *table;
@@ -95,7 +95,7 @@
 
 static void hash_destroy_nodes(struct hash_table *table)
 {
-	size_t i;
+	unsigned int i;
 
 	for (i = 0; i < table->size; i++) {
 		if (table->nodes[i].next != NULL)
@@ -297,7 +297,7 @@
 
 static void hash_compress_removed(struct hash_table *table)
 {
-	size_t i;
+	unsigned int i;
 
 	for (i = 0; i < table->size; i++)
 		hash_compress(table, &table->nodes[i]);
@@ -325,7 +325,7 @@
 		hash_compress(table, &table->nodes[hash % table->size]);
 }
 
-size_t hash_size(const struct hash_table *table)
+unsigned int hash_size(const struct hash_table *table)
 {
 	return table->nodes_count;
 }
@@ -405,7 +405,7 @@
 static bool hash_resize(struct hash_table *table, bool grow)
 {
 	struct hash_node *old_nodes, *node, *next;
-	size_t next_size, old_size, i;
+	unsigned int next_size, old_size, i;
 	float nodes_per_list;
 
         nodes_per_list = (float) table->nodes_count / (float) table->size;
--- a/src/lib/hash.h	Tue Jan 17 15:51:19 2006 +0200
+++ b/src/lib/hash.h	Tue Jan 17 16:03:45 2006 +0200
@@ -13,7 +13,7 @@
    for smaller allocations and can also be alloconly pool. The pools must not
    be free'd before hash_destroy() is called. */
 struct hash_table *
-hash_create(pool_t table_pool, pool_t node_pool, size_t initial_size,
+hash_create(pool_t table_pool, pool_t node_pool, unsigned int initial_size,
 	    hash_callback_t *hash_cb, hash_cmp_callback_t *key_compare_cb);
 void _hash_destroy(struct hash_table **table);
 #define hash_destroy(table) _hash_destroy(&(table))
@@ -32,7 +32,7 @@
 void hash_update(struct hash_table *table, void *key, void *value);
 
 void hash_remove(struct hash_table *table, const void *key);
-size_t hash_size(const struct hash_table *table);
+unsigned int hash_size(const struct hash_table *table);
 
 /* Iterates through all nodes in hash table. You may safely call hash_*()
    functions while iterating, but if you add any new nodes, they may or may