comparison src/elhash.c @ 4072:aa28d959af41

[xemacs-hg @ 2007-07-22 22:03:29 by aidan] Add support for non-ISO2022 8 bit fixed-width coding-systems
author aidan
date Sun, 22 Jul 2007 22:04:14 +0000
parents d674024a8674
children 229bd619740a
comparison
equal deleted inserted replaced
4071:d607d13fca67 4072:aa28d959af41
91 static Lisp_Object Q_size, Q_test, Q_weakness, Q_rehash_size, Q_rehash_threshold; 91 static Lisp_Object Q_size, Q_test, Q_weakness, Q_rehash_size, Q_rehash_threshold;
92 92
93 /* obsolete as of 19990901 in xemacs-21.2 */ 93 /* obsolete as of 19990901 in xemacs-21.2 */
94 static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qkey_or_value_weak; 94 static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qkey_or_value_weak;
95 static Lisp_Object Qnon_weak, Q_type; 95 static Lisp_Object Qnon_weak, Q_type;
96
97 typedef struct htentry
98 {
99 #ifdef NEW_GC
100 struct lrecord_header lheader;
101 #endif /* NEW_GC */
102 Lisp_Object key;
103 Lisp_Object value;
104 } htentry;
105 96
106 struct Lisp_Hash_Table 97 struct Lisp_Hash_Table
107 { 98 {
108 struct LCRECORD_HEADER header; 99 struct LCRECORD_HEADER header;
109 Elemcount size; 100 Elemcount size;
118 enum hash_table_weakness weakness; 109 enum hash_table_weakness weakness;
119 Lisp_Object next_weak; /* Used to chain together all of the weak 110 Lisp_Object next_weak; /* Used to chain together all of the weak
120 hash tables. Don't mark through this. */ 111 hash tables. Don't mark through this. */
121 }; 112 };
122 113
123 #define HTENTRY_CLEAR_P(htentry) ((*(EMACS_UINT*)(&((htentry)->key))) == 0)
124 #define CLEAR_HTENTRY(htentry) \ 114 #define CLEAR_HTENTRY(htentry) \
125 ((*(EMACS_UINT*)(&((htentry)->key))) = 0, \ 115 ((*(EMACS_UINT*)(&((htentry)->key))) = 0, \
126 (*(EMACS_UINT*)(&((htentry)->value))) = 0) 116 (*(EMACS_UINT*)(&((htentry)->value))) = 0)
127 117
128 #define HASH_TABLE_DEFAULT_SIZE 16 118 #define HASH_TABLE_DEFAULT_SIZE 16
1124 Elemcount new_size = 1114 Elemcount new_size =
1125 hash_table_size ((Elemcount) ((double) ht->size * ht->rehash_size)); 1115 hash_table_size ((Elemcount) ((double) ht->size * ht->rehash_size));
1126 resize_hash_table (ht, new_size); 1116 resize_hash_table (ht, new_size);
1127 } 1117 }
1128 1118
1129 static htentry * 1119 htentry *
1130 find_htentry (Lisp_Object key, const Lisp_Hash_Table *ht) 1120 find_htentry (Lisp_Object key, const Lisp_Hash_Table *ht)
1131 { 1121 {
1132 hash_table_test_function_t test_function = ht->test_function; 1122 hash_table_test_function_t test_function = ht->test_function;
1133 htentry *entries = ht->hentries; 1123 htentry *entries = ht->hentries;
1134 htentry *probe = entries + HASHCODE (key, ht); 1124 htentry *probe = entries + HASHCODE (key, ht);