comparison src/elhash.c @ 4962:e813cf16c015

merge
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 05:29:05 -0600
parents db2db229ee82 6ef8256a020a
children 16112448d484
comparison
equal deleted inserted replaced
4961:b90f8cf474e0 4962:e813cf16c015
182 } 182 }
183 return primes [high]; 183 return primes [high];
184 } 184 }
185 185
186 186
187 #if 0 /* I don't think these are needed any more.
188 If using the general lisp_object_equal_*() functions
189 causes efficiency problems, these can be resurrected. --ben */
190 /* equality and hash functions for Lisp strings */
191 int
192 lisp_string_equal (Lisp_Object str1, Lisp_Object str2)
193 {
194 /* This is wrong anyway. You can't use strcmp() on Lisp strings,
195 because they can contain zero characters. */
196 return !strcmp ((char *) XSTRING_DATA (str1), (char *) XSTRING_DATA (str2));
197 }
198
199 static Hashcode
200 lisp_string_hash (Lisp_Object obj)
201 {
202 return hash_string (XSTRING_DATA (str), XSTRING_LENGTH (str));
203 }
204
205 #endif /* 0 */
206 187
207 static int 188 static int
208 lisp_object_eql_equal (Lisp_Object obj1, Lisp_Object obj2) 189 lisp_object_eql_equal (Lisp_Object obj1, Lisp_Object obj2)
209 { 190 {
210 return EQ (obj1, obj2) || 191 return EQ (obj1, obj2) ||
261 function, which we don't do. Doing that would require consing, and 242 function, which we don't do. Doing that would require consing, and
262 consing is a bad idea in `equal'. Anyway, our method should provide 243 consing is a bad idea in `equal'. Anyway, our method should provide
263 the same result -- if the keys are not equal according to the test 244 the same result -- if the keys are not equal according to the test
264 function, then Fgethash() in hash_table_equal_mapper() will fail. */ 245 function, then Fgethash() in hash_table_equal_mapper() will fail. */
265 static int 246 static int
266 hash_table_equal (Lisp_Object hash_table1, Lisp_Object hash_table2, int depth) 247 hash_table_equal (Lisp_Object hash_table1, Lisp_Object hash_table2, int depth,
248 int foldcase)
267 { 249 {
268 Lisp_Hash_Table *ht1 = XHASH_TABLE (hash_table1); 250 Lisp_Hash_Table *ht1 = XHASH_TABLE (hash_table1);
269 Lisp_Hash_Table *ht2 = XHASH_TABLE (hash_table2); 251 Lisp_Hash_Table *ht2 = XHASH_TABLE (hash_table2);
270 htentry *e, *sentinel; 252 htentry *e, *sentinel;
271 253
280 if (!HTENTRY_CLEAR_P (e)) 262 if (!HTENTRY_CLEAR_P (e))
281 /* Look up the key in the other hash table, and compare the values. */ 263 /* Look up the key in the other hash table, and compare the values. */
282 { 264 {
283 Lisp_Object value_in_other = Fgethash (e->key, hash_table2, Qunbound); 265 Lisp_Object value_in_other = Fgethash (e->key, hash_table2, Qunbound);
284 if (UNBOUNDP (value_in_other) || 266 if (UNBOUNDP (value_in_other) ||
285 !internal_equal (e->value, value_in_other, depth)) 267 !internal_equal_0 (e->value, value_in_other, depth, foldcase))
286 return 0; /* Give up */ 268 return 0; /* Give up */
287 } 269 }
288 270
289 return 1; 271 return 1;
290 } 272 }