svn commit: r194095 - head/usr.sbin/nscd

Dag-Erling Smorgrav des at FreeBSD.org
Sat Jun 13 00:54:53 UTC 2009


Author: des
Date: Sat Jun 13 00:54:52 2009
New Revision: 194095
URL: http://svn.freebsd.org/changeset/base/194095

Log:
  Change hashtable_index_t to unsigned.
  Generate prototypes for our hash table.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/nscd/cachelib.c
  head/usr.sbin/nscd/hashtable.h

Modified: head/usr.sbin/nscd/cachelib.c
==============================================================================
--- head/usr.sbin/nscd/cachelib.c	Sat Jun 13 00:46:07 2009	(r194094)
+++ head/usr.sbin/nscd/cachelib.c	Sat Jun 13 00:54:52 2009	(r194095)
@@ -146,6 +146,7 @@ ht_item_hash_func(const void *p, size_t 
 	return retval;
 }
 
+HASHTABLE_PROTOTYPE(cache_ht_, cache_ht_item_, struct cache_ht_item_data_);
 HASHTABLE_GENERATE(cache_ht_, cache_ht_item_, struct cache_ht_item_data_, data,
 	ht_item_hash_func, ht_items_cmp_func);
 
@@ -291,7 +292,7 @@ clear_cache_entry(struct cache_entry_ *e
 	struct cache_policy_ *policy;
 	struct cache_policy_item_ *item, *next_item;
 	size_t entry_size;
-	int i;
+	unsigned int i;
 
 	if (entry->params->entry_type == CET_COMMON) {
 		common_entry = (struct cache_common_entry_ *)entry;
@@ -396,7 +397,6 @@ flush_cache_policy(struct cache_common_e
 
 		hash = HASHTABLE_CALCULATE_HASH(cache_ht_, &entry->items,
 			&ht_key);
-		assert(hash >= 0);
 		assert(hash < HASHTABLE_ENTRIES_COUNT(&entry->items));
 
 		ht_item = HASHTABLE_GET_ENTRY(&(entry->items), hash);
@@ -718,7 +718,6 @@ cache_read(struct cache_entry_ *entry, c
 
 	hash = HASHTABLE_CALCULATE_HASH(cache_ht_, &common_entry->items,
 		&item_data);
-	assert(hash >= 0);
 	assert(hash < HASHTABLE_ENTRIES_COUNT(&common_entry->items));
 
 	item = HASHTABLE_GET_ENTRY(&(common_entry->items), hash);
@@ -822,7 +821,6 @@ cache_write(struct cache_entry_ *entry, 
 
 	hash = HASHTABLE_CALCULATE_HASH(cache_ht_, &common_entry->items,
 		&item_data);
-	assert(hash >= 0);
 	assert(hash < HASHTABLE_ENTRIES_COUNT(&common_entry->items));
 
 	item = HASHTABLE_GET_ENTRY(&(common_entry->items), hash);

Modified: head/usr.sbin/nscd/hashtable.h
==============================================================================
--- head/usr.sbin/nscd/hashtable.h	Sat Jun 13 00:46:07 2009	(r194094)
+++ head/usr.sbin/nscd/hashtable.h	Sat Jun 13 00:54:52 2009	(r194095)
@@ -32,7 +32,7 @@
 #include <string.h>
 
 #define HASHTABLE_INITIAL_ENTRIES_CAPACITY 8
-typedef int hashtable_index_t;
+typedef unsigned int hashtable_index_t;
 
 /*
  * This file contains queue.h-like macro definitions for hash tables.


More information about the svn-src-all mailing list