X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Felhash.c;h=9055e93836cc05f32feb10455134396f72949481;hp=058fdd46d48577e7b30f7cb1772ec1d1b66ca785;hb=566b3d194e2d5c783808ac39437bd7e1a28b1c5c;hpb=2b7371e841478fd7b9bc7e4d9a515e0c26b9ed9a diff --git a/src/elhash.c b/src/elhash.c index 058fdd4..9055e93 100644 --- a/src/elhash.c +++ b/src/elhash.c @@ -336,7 +336,7 @@ print_hash_table (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) else if (ht->test_function == lisp_object_eql_equal) DO_NOTHING; else - abort (); + ABORT (); if (ht->count || !print_readably) { @@ -461,7 +461,7 @@ make_standard_lisp_hash_table (enum hash_table_test test, break; default: - abort (); + ABORT (); } return make_general_lisp_hash_table (hash_function, test_function, @@ -500,13 +500,7 @@ make_general_lisp_hash_table (hash_table_hash_function_t hash_function, compute_hash_table_derived_values (ht); /* We leave room for one never-occupied sentinel hentry at the end. */ - ht->hentries = xnew_array (hentry, ht->size + 1); - - { - hentry *e, *sentinel; - for (e = ht->hentries, sentinel = e + ht->size; e <= sentinel; e++) - CLEAR_HENTRY (e); - } + ht->hentries = xnew_array_and_zero (hentry, ht->size + 1); XSETHASH_TABLE (hash_table, ht); @@ -736,7 +730,7 @@ hash_table_instantiate (Lisp_Object plist) else if (EQ (key, Qdata)) data = value; else if (EQ (key, Qtype))/*obsolete*/ weakness = value; else - abort (); + ABORT (); } /* Create the hash table. */ @@ -815,7 +809,7 @@ Use Common Lisp style keywords to specify hash table properties. Keyword :test can be `eq', `eql' (default) or `equal'. Comparison between keys is done using this function. If speed is important, consider using `eq'. -When storing strings in the hash table, you will likely need to use `equal'. +When hash table keys may be strings, you will likely need to use `equal'. Keyword :size specifies the number of keys likely to be inserted. This number of entries can be inserted without enlarging the hash table. @@ -1207,6 +1201,19 @@ may remhash or puthash the entry currently being processed by FUNCTION. return Qnil; } +/* #### If the Lisp function being called does a puthash and this + #### causes the hash table to be resized, the results will be quite + #### random and we will likely crash. To fix this, either set a + #### flag in the hash table while we're mapping and signal an error + #### when new entries are added, or fix things to make this + #### operation work properly, like this: Store two hash tables in + #### each hash table object -- the second one is written to when + #### you do a puthash inside of a mapping operation, and the + #### various operations need to check both hash tables for entries. + #### As soon as the last maphash over a particular hash table + #### object terminates, the entries in the second table are added + #### to the first (using an unwind-protect). --ben */ + /* Map *C* function FUNCTION over the elements of a lisp hash table. */ void elisp_maphash (maphash_function_t function, @@ -1547,5 +1554,5 @@ vars_of_elhash (void) { /* This must NOT be staticpro'd */ Vall_weak_hash_tables = Qnil; - pdump_wire_list (&Vall_weak_hash_tables); + dump_add_weak_object_chain (&Vall_weak_hash_tables); }