00001 /* 00002 || This file is part of Pike. For copyright information see COPYRIGHT. 00003 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING 00004 || for more information. 00005 || $Id: hashtable.h,v 1.9 2002/10/11 01:39:32 nilsson Exp $ 00006 */ 00007 00008 #ifndef HASHTABLE_H 00009 #define HASHTABLE_H 00010 00011 #include "global.h" 00012 00013 #define AVERAGE_HASH_LENGTH 16 00014 #define NEW_HASHTABLE_SIZE 4 00015 00016 #ifndef STRUCT_HASH_ENTRY_DECLARED 00017 #define STRUCT_HASH_ENTRY_DECLARED 00018 #endif 00019 struct hash_entry 00020 { 00021 struct hash_entry *next; 00022 struct pike_string *s; 00023 }; 00024 00025 #ifndef STRUCT_HASH_TABLE_DECLARED 00026 #define STRUCT_HASH_TABLE_DECLARED 00027 #endif 00028 struct hash_table 00029 { 00030 INT32 mask; 00031 INT32 entries; 00032 struct hash_entry *htable[1]; 00033 }; 00034 00035 /* Prototypes begin here */ 00036 struct hash_entry *hash_lookup(struct hash_table *h, struct pike_string *s); 00037 struct hash_table *create_hash_table(void); 00038 struct hash_table *hash_rehash(struct hash_table *h,int size); 00039 struct hash_table *hash_insert(struct hash_table *h, struct hash_entry *s); 00040 struct hash_table *hash_unlink(struct hash_table *h, struct hash_entry *s); 00041 void map_hashtable(struct hash_table *h, void (*fun)(struct hash_entry *)); 00042 void free_hashtable(struct hash_table *h, 00043 void (*free_entry)(struct hash_entry *)); 00044 /* Prototypes end here */ 00045 00046 #endif
1.3.9.1