Changeset 1870 for trunk/src/kmk/strcache2.h
- Timestamp:
- Oct 17, 2008, 1:15:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/strcache2.h
r1869 r1870 51 51 struct strcache2_entry **hash_tab; /* The hash table. */ 52 52 int case_insensitive; /* case insensitive or not. */ 53 unsigned int hash_size; /* The hash table size. */ 53 unsigned int hash_mask; /* The AND mask matching hash_size.*/ 54 unsigned long lookup_count; /* The number of lookups. */ 55 unsigned long collision_1st_count; /* The number of 1st level collisions. */ 56 unsigned long collision_2nd_count; /* The number of 2nd level collisions. */ 57 unsigned long collision_3rd_count; /* The number of 3rd level collisions. */ 54 58 unsigned int count; /* Number entries in the cache. */ 55 59 unsigned int rehash_count; /* When to rehash the table. */ 56 unsigned long collision_count; /* The number of collisions. */ 57 unsigned long lookup_count; /* The number of lookups. */ 60 unsigned int init_size; /* The initial hash table size. */ 61 unsigned int hash_size; /* The hash table size. */ 62 unsigned int def_seg_size; /* The default segment size. */ 58 63 void *lock; /* The lock handle. */ 59 64 struct strcache2_seg *seg_head; /* The memory segment list. */ … … 63 68 64 69 65 void strcache2_init (struct strcache2 *cache, const char *name, int case_insensitive, int thread_safe); 70 void strcache2_init (struct strcache2 *cache, const char *name, unsigned int size, 71 unsigned int def_seg_size, int case_insensitive, int thread_safe); 66 72 void strcache2_term (struct strcache2 *cache); 67 73 void strcache2_print_stats (struct strcache2 *cache, const char *prefix); 68 74 void strcache2_print_stats_all (const char *prefix); 69 75 const char *strcache2_add (struct strcache2 *cache, const char *str, unsigned int length); 76 const char *strcache2_add_hashed (struct strcache2 *cache, const char *str, unsigned int length, 77 unsigned int hash1, unsigned int hash2); 78 int strcache2_is_cached (struct strcache2 *cache, const char *str); 70 79 int strcache2_verify_entry (struct strcache2 *cache, const char *str); 71 80 unsigned int strcache2_get_hash2_fallback (struct strcache2 *cache, const char *str); 81 unsigned int strcache2_hash_str (const char *str, unsigned int length, unsigned int *hash2p); 82 unsigned int strcache2_hash_istr (const char *str, unsigned int length, unsigned int *hash2p); 72 83 73 84 /* Get the hash table entry pointer. */ … … 100 111 { 101 112 unsigned int hash2 = strcache2_get_entry (cache, str)->hash2; 102 if ( hash2)113 if (!hash2) 103 114 hash2 = strcache2_get_hash2_fallback (cache, str); 104 115 return hash2;
Note:
See TracChangeset
for help on using the changeset viewer.