diff options
| author | Paul Eggert | 2011-06-02 01:25:28 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-02 01:25:28 -0700 |
| commit | 275a5dd65098a2d6fcc14c21f805fc8d5e4479ee (patch) | |
| tree | a03e79b0a7c066940ed02cd11927c7fd4080f092 /src | |
| parent | 97f4ea979720e535ade3fe0055fb710e18fb7b5d (diff) | |
| parent | f797625a8ca7bc973b6943c6fce97f1e479a283d (diff) | |
| download | emacs-275a5dd65098a2d6fcc14c21f805fc8d5e4479ee.tar.gz emacs-275a5dd65098a2d6fcc14c21f805fc8d5e4479ee.zip | |
Merge from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 83 | ||||
| -rw-r--r-- | src/alloc.c | 10 | ||||
| -rw-r--r-- | src/bytecode.c | 10 | ||||
| -rw-r--r-- | src/category.c | 4 | ||||
| -rw-r--r-- | src/ccl.c | 16 | ||||
| -rw-r--r-- | src/charset.c | 2 | ||||
| -rw-r--r-- | src/charset.h | 2 | ||||
| -rw-r--r-- | src/composite.c | 8 | ||||
| -rw-r--r-- | src/composite.h | 2 | ||||
| -rw-r--r-- | src/data.c | 4 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 9 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/fns.c | 234 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/image.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 47 | ||||
| -rw-r--r-- | src/makefile.w32-in | 2 | ||||
| -rw-r--r-- | src/minibuf.c | 77 | ||||
| -rw-r--r-- | src/print.c | 2 |
20 files changed, 317 insertions, 211 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6d642cb063d..7d372e0448a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,84 @@ | |||
| 1 | 2011-06-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Remove arbitrary limit of 2**31 entries in hash tables. (Bug#8771) | ||
| 4 | * category.c (hash_get_category_set): | ||
| 5 | * ccl.c (ccl_driver): | ||
| 6 | * charset.c (Fdefine_charset_internal): | ||
| 7 | * charset.h (struct charset.hash_index): | ||
| 8 | * composite.c (get_composition_id, gstring_lookup_cache) | ||
| 9 | (composition_gstring_put_cache): | ||
| 10 | * composite.h (struct composition.hash_index): | ||
| 11 | * dispextern.h (struct image.hash): | ||
| 12 | * fns.c (next_almost_prime, larger_vector, cmpfn_eql) | ||
| 13 | (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql) | ||
| 14 | (hashfn_equal, hashfn_user_defined, make_hash_table) | ||
| 15 | (maybe_resize_hash_table, hash_lookup, hash_put) | ||
| 16 | (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE) | ||
| 17 | (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector) | ||
| 18 | (Fsxhash, Fgethash, Fputhash, Fmaphash): | ||
| 19 | * image.c (make_image, search_image_cache, lookup_image) | ||
| 20 | (xpm_put_color_table_h): | ||
| 21 | * lisp.h (struct Lisp_Hash_Table): | ||
| 22 | * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): | ||
| 23 | * print.c (print): Use 'EMACS_UINT' and 'EMACS_INT' | ||
| 24 | for hashes and hash indexes, instead of 'unsigned' and 'int'. | ||
| 25 | * alloc.c (allocate_vectorlike): | ||
| 26 | Check for overflow in vector size calculations. | ||
| 27 | * ccl.c (ccl_driver): | ||
| 28 | Check for overflow when converting EMACS_INT to int. | ||
| 29 | * fns.c, image.c: Remove unnecessary static decls that would otherwise | ||
| 30 | need to be updated by these changes. | ||
| 31 | * fns.c (make_hash_table, maybe_resize_hash_table): | ||
| 32 | Check for integer overflow with large hash tables. | ||
| 33 | (make_hash_table, maybe_resize_hash_table, Fmake_hash_table): | ||
| 34 | Prefer the faster XFLOAT_DATA to XFLOATINT where either will do. | ||
| 35 | (SXHASH_REDUCE): New macro. | ||
| 36 | (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector): | ||
| 37 | Use it instead of discarding useful hash info with large hash values. | ||
| 38 | (sxhash_float): New function. | ||
| 39 | (sxhash): Use it. No more need for "& INTMASK" due to above changes. | ||
| 40 | * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc. | ||
| 41 | (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK): | ||
| 42 | Rewrite to use FIXNUM_BITS, as this simplifies things. | ||
| 43 | (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put): | ||
| 44 | Adjust signatures to match updated version of code. | ||
| 45 | (consing_since_gc): Now EMACS_INT, since a single hash table can | ||
| 46 | use more than INT_MAX bytes. | ||
| 47 | |||
| 48 | 2011-06-01 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 49 | |||
| 50 | Make it possible to build with GCC-4.6+ -O2 -flto. | ||
| 51 | |||
| 52 | * emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE. | ||
| 53 | |||
| 54 | 2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 55 | |||
| 56 | * minibuf.c (get_minibuffer, read_minibuf_unwind): | ||
| 57 | Call minibuffer-inactive-mode. | ||
| 58 | |||
| 59 | 2011-05-31 Juanma Barranquero <lekktu@gmail.com> | ||
| 60 | |||
| 61 | * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)): | ||
| 62 | Update dependencies. | ||
| 63 | |||
| 64 | 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 65 | |||
| 66 | * data.c (init_data): Remove code for UTS, this system is not | ||
| 67 | supported anymore. | ||
| 68 | |||
| 69 | 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 70 | |||
| 71 | Don't force ./temacs to start in terminal mode. | ||
| 72 | |||
| 73 | * frame.c (make_initial_frame): Initialize faces in all cases, not | ||
| 74 | only when CANNOT_DUMP is defined. | ||
| 75 | * dispnew.c (init_display): Remove CANNOT_DUMP condition. | ||
| 76 | |||
| 77 | 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 78 | |||
| 79 | * dispnew.c (add_window_display_history): Use const for the string | ||
| 80 | pointer. Remove declaration, not needed. | ||
| 81 | |||
| 1 | 2011-05-31 Paul Eggert <eggert@cs.ucla.edu> | 82 | 2011-05-31 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 83 | ||
| 3 | Malloc failure behavior now depends on size of allocation. | 84 | Malloc failure behavior now depends on size of allocation. |
| @@ -174,7 +255,7 @@ | |||
| 174 | 255 | ||
| 175 | merge count_size_as_multibyte, parse_str_to_multibyte | 256 | merge count_size_as_multibyte, parse_str_to_multibyte |
| 176 | * character.c, character.h (count_size_as_multibyte): | 257 | * character.c, character.h (count_size_as_multibyte): |
| 177 | Renamed from parse_str_to_multibyte; all uses changed. | 258 | Rename from parse_str_to_multibyte; all uses changed. |
| 178 | Check for integer overflow. | 259 | Check for integer overflow. |
| 179 | * insdel.c, lisp.h (count_size_as_multibyte): Remove, | 260 | * insdel.c, lisp.h (count_size_as_multibyte): Remove, |
| 180 | since it's now a duplicate of the other. This is more of | 261 | since it's now a duplicate of the other. This is more of |
diff --git a/src/alloc.c b/src/alloc.c index 6b901d5465e..4449dd989de 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -157,7 +157,7 @@ struct emacs_globals globals; | |||
| 157 | 157 | ||
| 158 | /* Number of bytes of consing done since the last gc. */ | 158 | /* Number of bytes of consing done since the last gc. */ |
| 159 | 159 | ||
| 160 | int consing_since_gc; | 160 | EMACS_INT consing_since_gc; |
| 161 | 161 | ||
| 162 | /* Similar minimum, computed from Vgc_cons_percentage. */ | 162 | /* Similar minimum, computed from Vgc_cons_percentage. */ |
| 163 | 163 | ||
| @@ -2789,6 +2789,11 @@ allocate_vectorlike (EMACS_INT len) | |||
| 2789 | { | 2789 | { |
| 2790 | struct Lisp_Vector *p; | 2790 | struct Lisp_Vector *p; |
| 2791 | size_t nbytes; | 2791 | size_t nbytes; |
| 2792 | int header_size = offsetof (struct Lisp_Vector, contents); | ||
| 2793 | int word_size = sizeof p->contents[0]; | ||
| 2794 | |||
| 2795 | if ((SIZE_MAX - header_size) / word_size < len) | ||
| 2796 | memory_full (); | ||
| 2792 | 2797 | ||
| 2793 | MALLOC_BLOCK_INPUT; | 2798 | MALLOC_BLOCK_INPUT; |
| 2794 | 2799 | ||
| @@ -2802,8 +2807,7 @@ allocate_vectorlike (EMACS_INT len) | |||
| 2802 | /* This gets triggered by code which I haven't bothered to fix. --Stef */ | 2807 | /* This gets triggered by code which I haven't bothered to fix. --Stef */ |
| 2803 | /* eassert (!handling_signal); */ | 2808 | /* eassert (!handling_signal); */ |
| 2804 | 2809 | ||
| 2805 | nbytes = (offsetof (struct Lisp_Vector, contents) | 2810 | nbytes = header_size + len * word_size; |
| 2806 | + len * sizeof p->contents[0]); | ||
| 2807 | p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); | 2811 | p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE); |
| 2808 | 2812 | ||
| 2809 | #ifdef DOUG_LEA_MALLOC | 2813 | #ifdef DOUG_LEA_MALLOC |
diff --git a/src/bytecode.c b/src/bytecode.c index c3cd3d43072..74cf401bf1d 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -144,7 +144,7 @@ Lisp_Object Qbytecode; | |||
| 144 | #define Bcurrent_column 0151 | 144 | #define Bcurrent_column 0151 |
| 145 | #define Bindent_to 0152 | 145 | #define Bindent_to 0152 |
| 146 | #ifdef BYTE_CODE_SAFE | 146 | #ifdef BYTE_CODE_SAFE |
| 147 | #define Bscan_buffer 0153 /* No longer generated as of v18 */ | 147 | #define Bscan_buffer 0153 /* No longer generated as of v18. */ |
| 148 | #endif | 148 | #endif |
| 149 | #define Beolp 0154 | 149 | #define Beolp 0154 |
| 150 | #define Beobp 0155 | 150 | #define Beobp 0155 |
| @@ -956,7 +956,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 956 | save_restriction_save ()); | 956 | save_restriction_save ()); |
| 957 | break; | 957 | break; |
| 958 | 958 | ||
| 959 | case Bcatch: /* FIXME: ill-suited for lexbind */ | 959 | case Bcatch: /* FIXME: ill-suited for lexbind. */ |
| 960 | { | 960 | { |
| 961 | Lisp_Object v1; | 961 | Lisp_Object v1; |
| 962 | BEFORE_POTENTIAL_GC (); | 962 | BEFORE_POTENTIAL_GC (); |
| @@ -966,11 +966,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 966 | break; | 966 | break; |
| 967 | } | 967 | } |
| 968 | 968 | ||
| 969 | case Bunwind_protect: /* FIXME: avoid closure for lexbind */ | 969 | case Bunwind_protect: /* FIXME: avoid closure for lexbind. */ |
| 970 | record_unwind_protect (Fprogn, POP); | 970 | record_unwind_protect (Fprogn, POP); |
| 971 | break; | 971 | break; |
| 972 | 972 | ||
| 973 | case Bcondition_case: /* FIXME: ill-suited for lexbind */ | 973 | case Bcondition_case: /* FIXME: ill-suited for lexbind. */ |
| 974 | { | 974 | { |
| 975 | Lisp_Object handlers, body; | 975 | Lisp_Object handlers, body; |
| 976 | handlers = POP; | 976 | handlers = POP; |
| @@ -1779,8 +1779,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1779 | PUSH (*ptr); | 1779 | PUSH (*ptr); |
| 1780 | break; | 1780 | break; |
| 1781 | } | 1781 | } |
| 1782 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ | ||
| 1783 | case Bstack_set: | 1782 | case Bstack_set: |
| 1783 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ | ||
| 1784 | { | 1784 | { |
| 1785 | Lisp_Object *ptr = top - (FETCH); | 1785 | Lisp_Object *ptr = top - (FETCH); |
| 1786 | *ptr = POP; | 1786 | *ptr = POP; |
diff --git a/src/category.c b/src/category.c index 356801a179c..23fd874c824 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -67,8 +67,8 @@ static Lisp_Object | |||
| 67 | hash_get_category_set (Lisp_Object table, Lisp_Object category_set) | 67 | hash_get_category_set (Lisp_Object table, Lisp_Object category_set) |
| 68 | { | 68 | { |
| 69 | struct Lisp_Hash_Table *h; | 69 | struct Lisp_Hash_Table *h; |
| 70 | int i; | 70 | EMACS_INT i; |
| 71 | unsigned hash; | 71 | EMACS_UINT hash; |
| 72 | 72 | ||
| 73 | if (NILP (XCHAR_TABLE (table)->extras[1])) | 73 | if (NILP (XCHAR_TABLE (table)->extras[1])) |
| 74 | XCHAR_TABLE (table)->extras[1] | 74 | XCHAR_TABLE (table)->extras[1] |
| @@ -1307,15 +1307,15 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1307 | : -1)); | 1307 | : -1)); |
| 1308 | h = GET_HASH_TABLE (eop); | 1308 | h = GET_HASH_TABLE (eop); |
| 1309 | 1309 | ||
| 1310 | op = hash_lookup (h, make_number (reg[RRR]), NULL); | 1310 | eop = hash_lookup (h, make_number (reg[RRR]), NULL); |
| 1311 | if (op >= 0) | 1311 | if (eop >= 0) |
| 1312 | { | 1312 | { |
| 1313 | Lisp_Object opl; | 1313 | Lisp_Object opl; |
| 1314 | opl = HASH_VALUE (h, op); | 1314 | opl = HASH_VALUE (h, eop); |
| 1315 | if (! CHARACTERP (opl)) | 1315 | if (! (IN_INT_RANGE (eop) && CHARACTERP (opl))) |
| 1316 | CCL_INVALID_CMD; | 1316 | CCL_INVALID_CMD; |
| 1317 | reg[RRR] = charset_unicode; | 1317 | reg[RRR] = charset_unicode; |
| 1318 | reg[rrr] = op; | 1318 | reg[rrr] = eop; |
| 1319 | reg[7] = 1; /* r7 true for success */ | 1319 | reg[7] = 1; /* r7 true for success */ |
| 1320 | } | 1320 | } |
| 1321 | else | 1321 | else |
| @@ -1334,11 +1334,11 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1334 | i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); | 1334 | i = CCL_DECODE_CHAR (reg[RRR], reg[rrr]); |
| 1335 | h = GET_HASH_TABLE (eop); | 1335 | h = GET_HASH_TABLE (eop); |
| 1336 | 1336 | ||
| 1337 | op = hash_lookup (h, make_number (i), NULL); | 1337 | eop = hash_lookup (h, make_number (i), NULL); |
| 1338 | if (op >= 0) | 1338 | if (eop >= 0) |
| 1339 | { | 1339 | { |
| 1340 | Lisp_Object opl; | 1340 | Lisp_Object opl; |
| 1341 | opl = HASH_VALUE (h, op); | 1341 | opl = HASH_VALUE (h, eop); |
| 1342 | if (! (INTEGERP (opl) && IN_INT_RANGE (XINT (opl)))) | 1342 | if (! (INTEGERP (opl) && IN_INT_RANGE (XINT (opl)))) |
| 1343 | CCL_INVALID_CMD; | 1343 | CCL_INVALID_CMD; |
| 1344 | reg[RRR] = XINT (opl); | 1344 | reg[RRR] = XINT (opl); |
diff --git a/src/charset.c b/src/charset.c index b1b4993d277..0af21b48ad2 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -849,7 +849,7 @@ usage: (define-charset-internal ...) */) | |||
| 849 | /* Charset attr vector. */ | 849 | /* Charset attr vector. */ |
| 850 | Lisp_Object attrs; | 850 | Lisp_Object attrs; |
| 851 | Lisp_Object val; | 851 | Lisp_Object val; |
| 852 | unsigned hash_code; | 852 | EMACS_UINT hash_code; |
| 853 | struct Lisp_Hash_Table *hash_table = XHASH_TABLE (Vcharset_hash_table); | 853 | struct Lisp_Hash_Table *hash_table = XHASH_TABLE (Vcharset_hash_table); |
| 854 | int i, j; | 854 | int i, j; |
| 855 | struct charset charset; | 855 | struct charset charset; |
diff --git a/src/charset.h b/src/charset.h index 53784bf8455..16f45ff9865 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -146,7 +146,7 @@ struct charset | |||
| 146 | int id; | 146 | int id; |
| 147 | 147 | ||
| 148 | /* Index to Vcharset_hash_table. */ | 148 | /* Index to Vcharset_hash_table. */ |
| 149 | int hash_index; | 149 | EMACS_INT hash_index; |
| 150 | 150 | ||
| 151 | /* Dimension of the charset: 1, 2, 3, or 4. */ | 151 | /* Dimension of the charset: 1, 2, 3, or 4. */ |
| 152 | int dimension; | 152 | int dimension; |
diff --git a/src/composite.c b/src/composite.c index 7849ffa3a18..ab9ec3f5a03 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -179,8 +179,8 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 179 | Lisp_Object id, length, components, key, *key_contents; | 179 | Lisp_Object id, length, components, key, *key_contents; |
| 180 | int glyph_len; | 180 | int glyph_len; |
| 181 | struct Lisp_Hash_Table *hash_table = XHASH_TABLE (composition_hash_table); | 181 | struct Lisp_Hash_Table *hash_table = XHASH_TABLE (composition_hash_table); |
| 182 | int hash_index; | 182 | EMACS_INT hash_index; |
| 183 | unsigned hash_code; | 183 | EMACS_UINT hash_code; |
| 184 | struct composition *cmp; | 184 | struct composition *cmp; |
| 185 | EMACS_INT i; | 185 | EMACS_INT i; |
| 186 | int ch; | 186 | int ch; |
| @@ -656,7 +656,7 @@ static Lisp_Object | |||
| 656 | gstring_lookup_cache (Lisp_Object header) | 656 | gstring_lookup_cache (Lisp_Object header) |
| 657 | { | 657 | { |
| 658 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); | 658 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); |
| 659 | int i = hash_lookup (h, header, NULL); | 659 | EMACS_INT i = hash_lookup (h, header, NULL); |
| 660 | 660 | ||
| 661 | return (i >= 0 ? HASH_VALUE (h, i) : Qnil); | 661 | return (i >= 0 ? HASH_VALUE (h, i) : Qnil); |
| 662 | } | 662 | } |
| @@ -665,7 +665,7 @@ Lisp_Object | |||
| 665 | composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len) | 665 | composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len) |
| 666 | { | 666 | { |
| 667 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); | 667 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); |
| 668 | unsigned hash; | 668 | EMACS_UINT hash; |
| 669 | Lisp_Object header, copy; | 669 | Lisp_Object header, copy; |
| 670 | EMACS_INT i; | 670 | EMACS_INT i; |
| 671 | 671 | ||
diff --git a/src/composite.h b/src/composite.h index 5188f981d9c..cc8ca10a139 100644 --- a/src/composite.h +++ b/src/composite.h | |||
| @@ -186,7 +186,7 @@ struct composition { | |||
| 186 | enum composition_method method; | 186 | enum composition_method method; |
| 187 | 187 | ||
| 188 | /* Index to the composition hash table. */ | 188 | /* Index to the composition hash table. */ |
| 189 | int hash_index; | 189 | EMACS_INT hash_index; |
| 190 | 190 | ||
| 191 | /* For which font we have calculated the remaining members. The | 191 | /* For which font we have calculated the remaining members. The |
| 192 | actual type is device dependent. */ | 192 | actual type is device dependent. */ |
diff --git a/src/data.c b/src/data.c index 443d78376d9..78bd454056d 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -3220,8 +3220,4 @@ init_data (void) | |||
| 3220 | return; | 3220 | return; |
| 3221 | #endif /* CANNOT_DUMP */ | 3221 | #endif /* CANNOT_DUMP */ |
| 3222 | signal (SIGFPE, arith_error); | 3222 | signal (SIGFPE, arith_error); |
| 3223 | |||
| 3224 | #ifdef uts | ||
| 3225 | signal (SIGEMT, arith_error); | ||
| 3226 | #endif /* uts */ | ||
| 3227 | } | 3223 | } |
diff --git a/src/dispextern.h b/src/dispextern.h index 5d8b4562499..e612a8b1eba 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2798,7 +2798,7 @@ struct image | |||
| 2798 | } data; | 2798 | } data; |
| 2799 | 2799 | ||
| 2800 | /* Hash value of image specification to speed up comparisons. */ | 2800 | /* Hash value of image specification to speed up comparisons. */ |
| 2801 | unsigned hash; | 2801 | EMACS_UINT hash; |
| 2802 | 2802 | ||
| 2803 | /* Image id of this image. */ | 2803 | /* Image id of this image. */ |
| 2804 | int id; | 2804 | int id; |
diff --git a/src/dispnew.c b/src/dispnew.c index cd20bd6e9aa..501dc4ffd80 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -290,7 +290,6 @@ static int history_idx; | |||
| 290 | static unsigned history_tick; | 290 | static unsigned history_tick; |
| 291 | 291 | ||
| 292 | static void add_frame_display_history (struct frame *, int); | 292 | static void add_frame_display_history (struct frame *, int); |
| 293 | static void add_window_display_history (struct window *, char *, int); | ||
| 294 | 293 | ||
| 295 | /* Add to the redisplay history how window W has been displayed. | 294 | /* Add to the redisplay history how window W has been displayed. |
| 296 | MSG is a trace containing the information how W's glyph matrix | 295 | MSG is a trace containing the information how W's glyph matrix |
| @@ -298,7 +297,7 @@ static void add_window_display_history (struct window *, char *, int); | |||
| 298 | has been interrupted for pending input. */ | 297 | has been interrupted for pending input. */ |
| 299 | 298 | ||
| 300 | static void | 299 | static void |
| 301 | add_window_display_history (struct window *w, char *msg, int paused_p) | 300 | add_window_display_history (struct window *w, const char *msg, int paused_p) |
| 302 | { | 301 | { |
| 303 | char *buf; | 302 | char *buf; |
| 304 | 303 | ||
| @@ -6234,11 +6233,7 @@ init_display (void) | |||
| 6234 | } | 6233 | } |
| 6235 | } | 6234 | } |
| 6236 | 6235 | ||
| 6237 | if (!inhibit_window_system && display_arg | 6236 | if (!inhibit_window_system && display_arg) |
| 6238 | #ifndef CANNOT_DUMP | ||
| 6239 | && initialized | ||
| 6240 | #endif | ||
| 6241 | ) | ||
| 6242 | { | 6237 | { |
| 6243 | Vinitial_window_system = Qx; | 6238 | Vinitial_window_system = Qx; |
| 6244 | #ifdef HAVE_X11 | 6239 | #ifdef HAVE_X11 |
diff --git a/src/emacs.c b/src/emacs.c index 3a7c5c0bf3d..70d90fd5781 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -678,7 +678,7 @@ malloc_initialize_hook (void) | |||
| 678 | } | 678 | } |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | void (*__malloc_initialize_hook) (void) = malloc_initialize_hook; | 681 | void (*__malloc_initialize_hook) (void) EXTERNALLY_VISIBLE = malloc_initialize_hook; |
| 682 | 682 | ||
| 683 | #endif /* DOUG_LEA_MALLOC */ | 683 | #endif /* DOUG_LEA_MALLOC */ |
| 684 | 684 | ||
| @@ -3358,21 +3358,6 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; | |||
| 3358 | static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); | 3358 | static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); |
| 3359 | static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *); | 3359 | static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *); |
| 3360 | static void maybe_resize_hash_table (struct Lisp_Hash_Table *); | 3360 | static void maybe_resize_hash_table (struct Lisp_Hash_Table *); |
| 3361 | static int cmpfn_eql (struct Lisp_Hash_Table *, Lisp_Object, unsigned, | ||
| 3362 | Lisp_Object, unsigned); | ||
| 3363 | static int cmpfn_equal (struct Lisp_Hash_Table *, Lisp_Object, unsigned, | ||
| 3364 | Lisp_Object, unsigned); | ||
| 3365 | static int cmpfn_user_defined (struct Lisp_Hash_Table *, Lisp_Object, | ||
| 3366 | unsigned, Lisp_Object, unsigned); | ||
| 3367 | static unsigned hashfn_eq (struct Lisp_Hash_Table *, Lisp_Object); | ||
| 3368 | static unsigned hashfn_eql (struct Lisp_Hash_Table *, Lisp_Object); | ||
| 3369 | static unsigned hashfn_equal (struct Lisp_Hash_Table *, Lisp_Object); | ||
| 3370 | static unsigned hashfn_user_defined (struct Lisp_Hash_Table *, | ||
| 3371 | Lisp_Object); | ||
| 3372 | static unsigned sxhash_string (unsigned char *, int); | ||
| 3373 | static unsigned sxhash_list (Lisp_Object, int); | ||
| 3374 | static unsigned sxhash_vector (Lisp_Object, int); | ||
| 3375 | static unsigned sxhash_bool_vector (Lisp_Object); | ||
| 3376 | static int sweep_weak_table (struct Lisp_Hash_Table *, int); | 3361 | static int sweep_weak_table (struct Lisp_Hash_Table *, int); |
| 3377 | 3362 | ||
| 3378 | 3363 | ||
| @@ -3395,8 +3380,8 @@ check_hash_table (Lisp_Object obj) | |||
| 3395 | /* Value is the next integer I >= N, N >= 0 which is "almost" a prime | 3380 | /* Value is the next integer I >= N, N >= 0 which is "almost" a prime |
| 3396 | number. */ | 3381 | number. */ |
| 3397 | 3382 | ||
| 3398 | int | 3383 | EMACS_INT |
| 3399 | next_almost_prime (int n) | 3384 | next_almost_prime (EMACS_INT n) |
| 3400 | { | 3385 | { |
| 3401 | if (n % 2 == 0) | 3386 | if (n % 2 == 0) |
| 3402 | n += 1; | 3387 | n += 1; |
| @@ -3436,10 +3421,10 @@ get_key_arg (Lisp_Object key, size_t nargs, Lisp_Object *args, char *used) | |||
| 3436 | vector that are not copied from VEC are set to INIT. */ | 3421 | vector that are not copied from VEC are set to INIT. */ |
| 3437 | 3422 | ||
| 3438 | Lisp_Object | 3423 | Lisp_Object |
| 3439 | larger_vector (Lisp_Object vec, int new_size, Lisp_Object init) | 3424 | larger_vector (Lisp_Object vec, EMACS_INT new_size, Lisp_Object init) |
| 3440 | { | 3425 | { |
| 3441 | struct Lisp_Vector *v; | 3426 | struct Lisp_Vector *v; |
| 3442 | int i, old_size; | 3427 | EMACS_INT i, old_size; |
| 3443 | 3428 | ||
| 3444 | xassert (VECTORP (vec)); | 3429 | xassert (VECTORP (vec)); |
| 3445 | old_size = ASIZE (vec); | 3430 | old_size = ASIZE (vec); |
| @@ -3463,7 +3448,9 @@ larger_vector (Lisp_Object vec, int new_size, Lisp_Object init) | |||
| 3463 | KEY2 are the same. */ | 3448 | KEY2 are the same. */ |
| 3464 | 3449 | ||
| 3465 | static int | 3450 | static int |
| 3466 | cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) | 3451 | cmpfn_eql (struct Lisp_Hash_Table *h, |
| 3452 | Lisp_Object key1, EMACS_UINT hash1, | ||
| 3453 | Lisp_Object key2, EMACS_UINT hash2) | ||
| 3467 | { | 3454 | { |
| 3468 | return (FLOATP (key1) | 3455 | return (FLOATP (key1) |
| 3469 | && FLOATP (key2) | 3456 | && FLOATP (key2) |
| @@ -3476,7 +3463,9 @@ cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp | |||
| 3476 | KEY2 are the same. */ | 3463 | KEY2 are the same. */ |
| 3477 | 3464 | ||
| 3478 | static int | 3465 | static int |
| 3479 | cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) | 3466 | cmpfn_equal (struct Lisp_Hash_Table *h, |
| 3467 | Lisp_Object key1, EMACS_UINT hash1, | ||
| 3468 | Lisp_Object key2, EMACS_UINT hash2) | ||
| 3480 | { | 3469 | { |
| 3481 | return hash1 == hash2 && !NILP (Fequal (key1, key2)); | 3470 | return hash1 == hash2 && !NILP (Fequal (key1, key2)); |
| 3482 | } | 3471 | } |
| @@ -3487,7 +3476,9 @@ cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Li | |||
| 3487 | if KEY1 and KEY2 are the same. */ | 3476 | if KEY1 and KEY2 are the same. */ |
| 3488 | 3477 | ||
| 3489 | static int | 3478 | static int |
| 3490 | cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int hash1, Lisp_Object key2, unsigned int hash2) | 3479 | cmpfn_user_defined (struct Lisp_Hash_Table *h, |
| 3480 | Lisp_Object key1, EMACS_UINT hash1, | ||
| 3481 | Lisp_Object key2, EMACS_UINT hash2) | ||
| 3491 | { | 3482 | { |
| 3492 | if (hash1 == hash2) | 3483 | if (hash1 == hash2) |
| 3493 | { | 3484 | { |
| @@ -3507,10 +3498,10 @@ cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, unsigned int ha | |||
| 3507 | `eq' to compare keys. The hash code returned is guaranteed to fit | 3498 | `eq' to compare keys. The hash code returned is guaranteed to fit |
| 3508 | in a Lisp integer. */ | 3499 | in a Lisp integer. */ |
| 3509 | 3500 | ||
| 3510 | static unsigned | 3501 | static EMACS_UINT |
| 3511 | hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key) | 3502 | hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3512 | { | 3503 | { |
| 3513 | unsigned hash = XUINT (key) ^ XTYPE (key); | 3504 | EMACS_UINT hash = XUINT (key) ^ XTYPE (key); |
| 3514 | xassert ((hash & ~INTMASK) == 0); | 3505 | xassert ((hash & ~INTMASK) == 0); |
| 3515 | return hash; | 3506 | return hash; |
| 3516 | } | 3507 | } |
| @@ -3520,10 +3511,10 @@ hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3520 | `eql' to compare keys. The hash code returned is guaranteed to fit | 3511 | `eql' to compare keys. The hash code returned is guaranteed to fit |
| 3521 | in a Lisp integer. */ | 3512 | in a Lisp integer. */ |
| 3522 | 3513 | ||
| 3523 | static unsigned | 3514 | static EMACS_UINT |
| 3524 | hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key) | 3515 | hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3525 | { | 3516 | { |
| 3526 | unsigned hash; | 3517 | EMACS_UINT hash; |
| 3527 | if (FLOATP (key)) | 3518 | if (FLOATP (key)) |
| 3528 | hash = sxhash (key, 0); | 3519 | hash = sxhash (key, 0); |
| 3529 | else | 3520 | else |
| @@ -3537,10 +3528,10 @@ hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3537 | `equal' to compare keys. The hash code returned is guaranteed to fit | 3528 | `equal' to compare keys. The hash code returned is guaranteed to fit |
| 3538 | in a Lisp integer. */ | 3529 | in a Lisp integer. */ |
| 3539 | 3530 | ||
| 3540 | static unsigned | 3531 | static EMACS_UINT |
| 3541 | hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key) | 3532 | hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3542 | { | 3533 | { |
| 3543 | unsigned hash = sxhash (key, 0); | 3534 | EMACS_UINT hash = sxhash (key, 0); |
| 3544 | xassert ((hash & ~INTMASK) == 0); | 3535 | xassert ((hash & ~INTMASK) == 0); |
| 3545 | return hash; | 3536 | return hash; |
| 3546 | } | 3537 | } |
| @@ -3550,7 +3541,7 @@ hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3550 | user-defined function to compare keys. The hash code returned is | 3541 | user-defined function to compare keys. The hash code returned is |
| 3551 | guaranteed to fit in a Lisp integer. */ | 3542 | guaranteed to fit in a Lisp integer. */ |
| 3552 | 3543 | ||
| 3553 | static unsigned | 3544 | static EMACS_UINT |
| 3554 | hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key) | 3545 | hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3555 | { | 3546 | { |
| 3556 | Lisp_Object args[2], hash; | 3547 | Lisp_Object args[2], hash; |
| @@ -3593,26 +3584,33 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size, | |||
| 3593 | { | 3584 | { |
| 3594 | struct Lisp_Hash_Table *h; | 3585 | struct Lisp_Hash_Table *h; |
| 3595 | Lisp_Object table; | 3586 | Lisp_Object table; |
| 3596 | int index_size, i, sz; | 3587 | EMACS_INT index_size, i, sz; |
| 3588 | double index_float; | ||
| 3597 | 3589 | ||
| 3598 | /* Preconditions. */ | 3590 | /* Preconditions. */ |
| 3599 | xassert (SYMBOLP (test)); | 3591 | xassert (SYMBOLP (test)); |
| 3600 | xassert (INTEGERP (size) && XINT (size) >= 0); | 3592 | xassert (INTEGERP (size) && XINT (size) >= 0); |
| 3601 | xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 3593 | xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) |
| 3602 | || (FLOATP (rehash_size) && XFLOATINT (rehash_size) > 1.0)); | 3594 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))); |
| 3603 | xassert (FLOATP (rehash_threshold) | 3595 | xassert (FLOATP (rehash_threshold) |
| 3604 | && XFLOATINT (rehash_threshold) > 0 | 3596 | && 0 < XFLOAT_DATA (rehash_threshold) |
| 3605 | && XFLOATINT (rehash_threshold) <= 1.0); | 3597 | && XFLOAT_DATA (rehash_threshold) <= 1.0); |
| 3606 | 3598 | ||
| 3607 | if (XFASTINT (size) == 0) | 3599 | if (XFASTINT (size) == 0) |
| 3608 | size = make_number (1); | 3600 | size = make_number (1); |
| 3609 | 3601 | ||
| 3602 | sz = XFASTINT (size); | ||
| 3603 | index_float = sz / XFLOAT_DATA (rehash_threshold); | ||
| 3604 | index_size = (index_float < MOST_POSITIVE_FIXNUM + 1 | ||
| 3605 | ? next_almost_prime (index_float) | ||
| 3606 | : MOST_POSITIVE_FIXNUM + 1); | ||
| 3607 | if (MOST_POSITIVE_FIXNUM < max (index_size, 2 * sz)) | ||
| 3608 | error ("Hash table too large"); | ||
| 3609 | |||
| 3610 | /* Allocate a table and initialize it. */ | 3610 | /* Allocate a table and initialize it. */ |
| 3611 | h = allocate_hash_table (); | 3611 | h = allocate_hash_table (); |
| 3612 | 3612 | ||
| 3613 | /* Initialize hash table slots. */ | 3613 | /* Initialize hash table slots. */ |
| 3614 | sz = XFASTINT (size); | ||
| 3615 | |||
| 3616 | h->test = test; | 3614 | h->test = test; |
| 3617 | if (EQ (test, Qeql)) | 3615 | if (EQ (test, Qeql)) |
| 3618 | { | 3616 | { |
| @@ -3644,8 +3642,6 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size, | |||
| 3644 | h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil); | 3642 | h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil); |
| 3645 | h->hash = Fmake_vector (size, Qnil); | 3643 | h->hash = Fmake_vector (size, Qnil); |
| 3646 | h->next = Fmake_vector (size, Qnil); | 3644 | h->next = Fmake_vector (size, Qnil); |
| 3647 | /* Cast to int here avoids losing with gcc 2.95 on Tru64/Alpha... */ | ||
| 3648 | index_size = next_almost_prime ((int) (sz / XFLOATINT (rehash_threshold))); | ||
| 3649 | h->index = Fmake_vector (make_number (index_size), Qnil); | 3645 | h->index = Fmake_vector (make_number (index_size), Qnil); |
| 3650 | 3646 | ||
| 3651 | /* Set up the free list. */ | 3647 | /* Set up the free list. */ |
| @@ -3709,20 +3705,29 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3709 | { | 3705 | { |
| 3710 | if (NILP (h->next_free)) | 3706 | if (NILP (h->next_free)) |
| 3711 | { | 3707 | { |
| 3712 | int old_size = HASH_TABLE_SIZE (h); | 3708 | EMACS_INT old_size = HASH_TABLE_SIZE (h); |
| 3713 | int i, new_size, index_size; | 3709 | EMACS_INT i, new_size, index_size; |
| 3714 | EMACS_INT nsize; | 3710 | EMACS_INT nsize; |
| 3711 | double index_float; | ||
| 3715 | 3712 | ||
| 3716 | if (INTEGERP (h->rehash_size)) | 3713 | if (INTEGERP (h->rehash_size)) |
| 3717 | new_size = old_size + XFASTINT (h->rehash_size); | 3714 | new_size = old_size + XFASTINT (h->rehash_size); |
| 3718 | else | 3715 | else |
| 3719 | new_size = old_size * XFLOATINT (h->rehash_size); | 3716 | { |
| 3720 | new_size = max (old_size + 1, new_size); | 3717 | double float_new_size = old_size * XFLOAT_DATA (h->rehash_size); |
| 3721 | index_size = next_almost_prime ((int) | 3718 | if (float_new_size < MOST_POSITIVE_FIXNUM + 1) |
| 3722 | (new_size | 3719 | { |
| 3723 | / XFLOATINT (h->rehash_threshold))); | 3720 | new_size = float_new_size; |
| 3724 | /* Assignment to EMACS_INT stops GCC whining about limited range | 3721 | if (new_size <= old_size) |
| 3725 | of data type. */ | 3722 | new_size = old_size + 1; |
| 3723 | } | ||
| 3724 | else | ||
| 3725 | new_size = MOST_POSITIVE_FIXNUM + 1; | ||
| 3726 | } | ||
| 3727 | index_float = new_size / XFLOAT_DATA (h->rehash_threshold); | ||
| 3728 | index_size = (index_float < MOST_POSITIVE_FIXNUM + 1 | ||
| 3729 | ? next_almost_prime (index_float) | ||
| 3730 | : MOST_POSITIVE_FIXNUM + 1); | ||
| 3726 | nsize = max (index_size, 2 * new_size); | 3731 | nsize = max (index_size, 2 * new_size); |
| 3727 | if (nsize > MOST_POSITIVE_FIXNUM) | 3732 | if (nsize > MOST_POSITIVE_FIXNUM) |
| 3728 | error ("Hash table too large to resize"); | 3733 | error ("Hash table too large to resize"); |
| @@ -3756,8 +3761,8 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3756 | for (i = 0; i < old_size; ++i) | 3761 | for (i = 0; i < old_size; ++i) |
| 3757 | if (!NILP (HASH_HASH (h, i))) | 3762 | if (!NILP (HASH_HASH (h, i))) |
| 3758 | { | 3763 | { |
| 3759 | unsigned hash_code = XUINT (HASH_HASH (h, i)); | 3764 | EMACS_UINT hash_code = XUINT (HASH_HASH (h, i)); |
| 3760 | int start_of_bucket = hash_code % ASIZE (h->index); | 3765 | EMACS_INT start_of_bucket = hash_code % ASIZE (h->index); |
| 3761 | HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); | 3766 | HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); |
| 3762 | HASH_INDEX (h, start_of_bucket) = make_number (i); | 3767 | HASH_INDEX (h, start_of_bucket) = make_number (i); |
| 3763 | } | 3768 | } |
| @@ -3769,11 +3774,11 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3769 | the hash code of KEY. Value is the index of the entry in H | 3774 | the hash code of KEY. Value is the index of the entry in H |
| 3770 | matching KEY, or -1 if not found. */ | 3775 | matching KEY, or -1 if not found. */ |
| 3771 | 3776 | ||
| 3772 | int | 3777 | EMACS_INT |
| 3773 | hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash) | 3778 | hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, EMACS_UINT *hash) |
| 3774 | { | 3779 | { |
| 3775 | unsigned hash_code; | 3780 | EMACS_UINT hash_code; |
| 3776 | int start_of_bucket; | 3781 | EMACS_INT start_of_bucket; |
| 3777 | Lisp_Object idx; | 3782 | Lisp_Object idx; |
| 3778 | 3783 | ||
| 3779 | hash_code = h->hashfn (h, key); | 3784 | hash_code = h->hashfn (h, key); |
| @@ -3786,7 +3791,7 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash) | |||
| 3786 | /* We need not gcpro idx since it's either an integer or nil. */ | 3791 | /* We need not gcpro idx since it's either an integer or nil. */ |
| 3787 | while (!NILP (idx)) | 3792 | while (!NILP (idx)) |
| 3788 | { | 3793 | { |
| 3789 | int i = XFASTINT (idx); | 3794 | EMACS_INT i = XFASTINT (idx); |
| 3790 | if (EQ (key, HASH_KEY (h, i)) | 3795 | if (EQ (key, HASH_KEY (h, i)) |
| 3791 | || (h->cmpfn | 3796 | || (h->cmpfn |
| 3792 | && h->cmpfn (h, key, hash_code, | 3797 | && h->cmpfn (h, key, hash_code, |
| @@ -3803,10 +3808,11 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, unsigned int *hash) | |||
| 3803 | HASH is a previously computed hash code of KEY. | 3808 | HASH is a previously computed hash code of KEY. |
| 3804 | Value is the index of the entry in H matching KEY. */ | 3809 | Value is the index of the entry in H matching KEY. */ |
| 3805 | 3810 | ||
| 3806 | int | 3811 | EMACS_INT |
| 3807 | hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, unsigned int hash) | 3812 | hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, |
| 3813 | EMACS_UINT hash) | ||
| 3808 | { | 3814 | { |
| 3809 | int start_of_bucket, i; | 3815 | EMACS_INT start_of_bucket, i; |
| 3810 | 3816 | ||
| 3811 | xassert ((hash & ~INTMASK) == 0); | 3817 | xassert ((hash & ~INTMASK) == 0); |
| 3812 | 3818 | ||
| @@ -3836,8 +3842,8 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value, unsigne | |||
| 3836 | static void | 3842 | static void |
| 3837 | hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) | 3843 | hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3838 | { | 3844 | { |
| 3839 | unsigned hash_code; | 3845 | EMACS_UINT hash_code; |
| 3840 | int start_of_bucket; | 3846 | EMACS_INT start_of_bucket; |
| 3841 | Lisp_Object idx, prev; | 3847 | Lisp_Object idx, prev; |
| 3842 | 3848 | ||
| 3843 | hash_code = h->hashfn (h, key); | 3849 | hash_code = h->hashfn (h, key); |
| @@ -3848,7 +3854,7 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3848 | /* We need not gcpro idx, prev since they're either integers or nil. */ | 3854 | /* We need not gcpro idx, prev since they're either integers or nil. */ |
| 3849 | while (!NILP (idx)) | 3855 | while (!NILP (idx)) |
| 3850 | { | 3856 | { |
| 3851 | int i = XFASTINT (idx); | 3857 | EMACS_INT i = XFASTINT (idx); |
| 3852 | 3858 | ||
| 3853 | if (EQ (key, HASH_KEY (h, i)) | 3859 | if (EQ (key, HASH_KEY (h, i)) |
| 3854 | || (h->cmpfn | 3860 | || (h->cmpfn |
| @@ -3886,7 +3892,7 @@ hash_clear (struct Lisp_Hash_Table *h) | |||
| 3886 | { | 3892 | { |
| 3887 | if (h->count > 0) | 3893 | if (h->count > 0) |
| 3888 | { | 3894 | { |
| 3889 | int i, size = HASH_TABLE_SIZE (h); | 3895 | EMACS_INT i, size = HASH_TABLE_SIZE (h); |
| 3890 | 3896 | ||
| 3891 | for (i = 0; i < size; ++i) | 3897 | for (i = 0; i < size; ++i) |
| 3892 | { | 3898 | { |
| @@ -3924,7 +3930,8 @@ init_weak_hash_tables (void) | |||
| 3924 | static int | 3930 | static int |
| 3925 | sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) | 3931 | sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) |
| 3926 | { | 3932 | { |
| 3927 | int bucket, n, marked; | 3933 | EMACS_INT bucket, n; |
| 3934 | int marked; | ||
| 3928 | 3935 | ||
| 3929 | n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; | 3936 | n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; |
| 3930 | marked = 0; | 3937 | marked = 0; |
| @@ -3938,7 +3945,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) | |||
| 3938 | prev = Qnil; | 3945 | prev = Qnil; |
| 3939 | for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) | 3946 | for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) |
| 3940 | { | 3947 | { |
| 3941 | int i = XFASTINT (idx); | 3948 | EMACS_INT i = XFASTINT (idx); |
| 3942 | int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); | 3949 | int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); |
| 3943 | int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); | 3950 | int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); |
| 3944 | int remove_p; | 3951 | int remove_p; |
| @@ -4067,43 +4074,68 @@ sweep_weak_hash_tables (void) | |||
| 4067 | 4074 | ||
| 4068 | #define SXHASH_MAX_LEN 7 | 4075 | #define SXHASH_MAX_LEN 7 |
| 4069 | 4076 | ||
| 4070 | /* Combine two integers X and Y for hashing. */ | 4077 | /* Combine two integers X and Y for hashing. The result might not fit |
| 4078 | into a Lisp integer. */ | ||
| 4071 | 4079 | ||
| 4072 | #define SXHASH_COMBINE(X, Y) \ | 4080 | #define SXHASH_COMBINE(X, Y) \ |
| 4073 | ((((unsigned)(X) << 4) + (((unsigned)(X) >> 24) & 0x0fffffff)) \ | 4081 | ((((EMACS_UINT) (X) << 4) + ((EMACS_UINT) (X) >> (BITS_PER_EMACS_INT - 4))) \ |
| 4074 | + (unsigned)(Y)) | 4082 | + (EMACS_UINT) (Y)) |
| 4075 | 4083 | ||
| 4084 | /* Hash X, returning a value that fits into a Lisp integer. */ | ||
| 4085 | #define SXHASH_REDUCE(X) \ | ||
| 4086 | ((((X) ^ (X) >> (BITS_PER_EMACS_INT - FIXNUM_BITS))) & INTMASK) | ||
| 4076 | 4087 | ||
| 4077 | /* Return a hash for string PTR which has length LEN. The hash | 4088 | /* Return a hash for string PTR which has length LEN. The hash |
| 4078 | code returned is guaranteed to fit in a Lisp integer. */ | 4089 | code returned is guaranteed to fit in a Lisp integer. */ |
| 4079 | 4090 | ||
| 4080 | static unsigned | 4091 | static EMACS_UINT |
| 4081 | sxhash_string (unsigned char *ptr, int len) | 4092 | sxhash_string (unsigned char *ptr, EMACS_INT len) |
| 4082 | { | 4093 | { |
| 4083 | unsigned char *p = ptr; | 4094 | unsigned char *p = ptr; |
| 4084 | unsigned char *end = p + len; | 4095 | unsigned char *end = p + len; |
| 4085 | unsigned char c; | 4096 | unsigned char c; |
| 4086 | unsigned hash = 0; | 4097 | EMACS_UINT hash = 0; |
| 4087 | 4098 | ||
| 4088 | while (p != end) | 4099 | while (p != end) |
| 4089 | { | 4100 | { |
| 4090 | c = *p++; | 4101 | c = *p++; |
| 4091 | if (c >= 0140) | 4102 | if (c >= 0140) |
| 4092 | c -= 40; | 4103 | c -= 40; |
| 4093 | hash = ((hash << 4) + (hash >> 28) + c); | 4104 | hash = SXHASH_COMBINE (hash, c); |
| 4094 | } | 4105 | } |
| 4095 | 4106 | ||
| 4096 | return hash & INTMASK; | 4107 | return SXHASH_REDUCE (hash); |
| 4097 | } | 4108 | } |
| 4098 | 4109 | ||
| 4110 | /* Return a hash for the floating point value VAL. */ | ||
| 4111 | |||
| 4112 | static EMACS_INT | ||
| 4113 | sxhash_float (double val) | ||
| 4114 | { | ||
| 4115 | EMACS_UINT hash = 0; | ||
| 4116 | enum { | ||
| 4117 | WORDS_PER_DOUBLE = (sizeof val / sizeof hash | ||
| 4118 | + (sizeof val % sizeof hash != 0)) | ||
| 4119 | }; | ||
| 4120 | union { | ||
| 4121 | double val; | ||
| 4122 | EMACS_UINT word[WORDS_PER_DOUBLE]; | ||
| 4123 | } u; | ||
| 4124 | int i; | ||
| 4125 | u.val = val; | ||
| 4126 | memset (&u.val + 1, 0, sizeof u - sizeof u.val); | ||
| 4127 | for (i = 0; i < WORDS_PER_DOUBLE; i++) | ||
| 4128 | hash = SXHASH_COMBINE (hash, u.word[i]); | ||
| 4129 | return SXHASH_REDUCE (hash); | ||
| 4130 | } | ||
| 4099 | 4131 | ||
| 4100 | /* Return a hash for list LIST. DEPTH is the current depth in the | 4132 | /* Return a hash for list LIST. DEPTH is the current depth in the |
| 4101 | list. We don't recurse deeper than SXHASH_MAX_DEPTH in it. */ | 4133 | list. We don't recurse deeper than SXHASH_MAX_DEPTH in it. */ |
| 4102 | 4134 | ||
| 4103 | static unsigned | 4135 | static EMACS_UINT |
| 4104 | sxhash_list (Lisp_Object list, int depth) | 4136 | sxhash_list (Lisp_Object list, int depth) |
| 4105 | { | 4137 | { |
| 4106 | unsigned hash = 0; | 4138 | EMACS_UINT hash = 0; |
| 4107 | int i; | 4139 | int i; |
| 4108 | 4140 | ||
| 4109 | if (depth < SXHASH_MAX_DEPTH) | 4141 | if (depth < SXHASH_MAX_DEPTH) |
| @@ -4111,63 +4143,62 @@ sxhash_list (Lisp_Object list, int depth) | |||
| 4111 | CONSP (list) && i < SXHASH_MAX_LEN; | 4143 | CONSP (list) && i < SXHASH_MAX_LEN; |
| 4112 | list = XCDR (list), ++i) | 4144 | list = XCDR (list), ++i) |
| 4113 | { | 4145 | { |
| 4114 | unsigned hash2 = sxhash (XCAR (list), depth + 1); | 4146 | EMACS_UINT hash2 = sxhash (XCAR (list), depth + 1); |
| 4115 | hash = SXHASH_COMBINE (hash, hash2); | 4147 | hash = SXHASH_COMBINE (hash, hash2); |
| 4116 | } | 4148 | } |
| 4117 | 4149 | ||
| 4118 | if (!NILP (list)) | 4150 | if (!NILP (list)) |
| 4119 | { | 4151 | { |
| 4120 | unsigned hash2 = sxhash (list, depth + 1); | 4152 | EMACS_UINT hash2 = sxhash (list, depth + 1); |
| 4121 | hash = SXHASH_COMBINE (hash, hash2); | 4153 | hash = SXHASH_COMBINE (hash, hash2); |
| 4122 | } | 4154 | } |
| 4123 | 4155 | ||
| 4124 | return hash; | 4156 | return SXHASH_REDUCE (hash); |
| 4125 | } | 4157 | } |
| 4126 | 4158 | ||
| 4127 | 4159 | ||
| 4128 | /* Return a hash for vector VECTOR. DEPTH is the current depth in | 4160 | /* Return a hash for vector VECTOR. DEPTH is the current depth in |
| 4129 | the Lisp structure. */ | 4161 | the Lisp structure. */ |
| 4130 | 4162 | ||
| 4131 | static unsigned | 4163 | static EMACS_UINT |
| 4132 | sxhash_vector (Lisp_Object vec, int depth) | 4164 | sxhash_vector (Lisp_Object vec, int depth) |
| 4133 | { | 4165 | { |
| 4134 | unsigned hash = ASIZE (vec); | 4166 | EMACS_UINT hash = ASIZE (vec); |
| 4135 | int i, n; | 4167 | int i, n; |
| 4136 | 4168 | ||
| 4137 | n = min (SXHASH_MAX_LEN, ASIZE (vec)); | 4169 | n = min (SXHASH_MAX_LEN, ASIZE (vec)); |
| 4138 | for (i = 0; i < n; ++i) | 4170 | for (i = 0; i < n; ++i) |
| 4139 | { | 4171 | { |
| 4140 | unsigned hash2 = sxhash (AREF (vec, i), depth + 1); | 4172 | EMACS_UINT hash2 = sxhash (AREF (vec, i), depth + 1); |
| 4141 | hash = SXHASH_COMBINE (hash, hash2); | 4173 | hash = SXHASH_COMBINE (hash, hash2); |
| 4142 | } | 4174 | } |
| 4143 | 4175 | ||
| 4144 | return hash; | 4176 | return SXHASH_REDUCE (hash); |
| 4145 | } | 4177 | } |
| 4146 | 4178 | ||
| 4147 | |||
| 4148 | /* Return a hash for bool-vector VECTOR. */ | 4179 | /* Return a hash for bool-vector VECTOR. */ |
| 4149 | 4180 | ||
| 4150 | static unsigned | 4181 | static EMACS_UINT |
| 4151 | sxhash_bool_vector (Lisp_Object vec) | 4182 | sxhash_bool_vector (Lisp_Object vec) |
| 4152 | { | 4183 | { |
| 4153 | unsigned hash = XBOOL_VECTOR (vec)->size; | 4184 | EMACS_UINT hash = XBOOL_VECTOR (vec)->size; |
| 4154 | int i, n; | 4185 | int i, n; |
| 4155 | 4186 | ||
| 4156 | n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size); | 4187 | n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size); |
| 4157 | for (i = 0; i < n; ++i) | 4188 | for (i = 0; i < n; ++i) |
| 4158 | hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]); | 4189 | hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]); |
| 4159 | 4190 | ||
| 4160 | return hash; | 4191 | return SXHASH_REDUCE (hash); |
| 4161 | } | 4192 | } |
| 4162 | 4193 | ||
| 4163 | 4194 | ||
| 4164 | /* Return a hash code for OBJ. DEPTH is the current depth in the Lisp | 4195 | /* Return a hash code for OBJ. DEPTH is the current depth in the Lisp |
| 4165 | structure. Value is an unsigned integer clipped to INTMASK. */ | 4196 | structure. Value is an unsigned integer clipped to INTMASK. */ |
| 4166 | 4197 | ||
| 4167 | unsigned | 4198 | EMACS_UINT |
| 4168 | sxhash (Lisp_Object obj, int depth) | 4199 | sxhash (Lisp_Object obj, int depth) |
| 4169 | { | 4200 | { |
| 4170 | unsigned hash; | 4201 | EMACS_UINT hash; |
| 4171 | 4202 | ||
| 4172 | if (depth > SXHASH_MAX_DEPTH) | 4203 | if (depth > SXHASH_MAX_DEPTH) |
| 4173 | return 0; | 4204 | return 0; |
| @@ -4211,20 +4242,14 @@ sxhash (Lisp_Object obj, int depth) | |||
| 4211 | break; | 4242 | break; |
| 4212 | 4243 | ||
| 4213 | case Lisp_Float: | 4244 | case Lisp_Float: |
| 4214 | { | 4245 | hash = sxhash_float (XFLOAT_DATA (obj)); |
| 4215 | double val = XFLOAT_DATA (obj); | 4246 | break; |
| 4216 | unsigned char *p = (unsigned char *) &val; | ||
| 4217 | size_t i; | ||
| 4218 | for (hash = 0, i = 0; i < sizeof val; i++) | ||
| 4219 | hash = SXHASH_COMBINE (hash, p[i]); | ||
| 4220 | break; | ||
| 4221 | } | ||
| 4222 | 4247 | ||
| 4223 | default: | 4248 | default: |
| 4224 | abort (); | 4249 | abort (); |
| 4225 | } | 4250 | } |
| 4226 | 4251 | ||
| 4227 | return hash & INTMASK; | 4252 | return hash; |
| 4228 | } | 4253 | } |
| 4229 | 4254 | ||
| 4230 | 4255 | ||
| @@ -4238,7 +4263,7 @@ DEFUN ("sxhash", Fsxhash, Ssxhash, 1, 1, 0, | |||
| 4238 | doc: /* Compute a hash code for OBJ and return it as integer. */) | 4263 | doc: /* Compute a hash code for OBJ and return it as integer. */) |
| 4239 | (Lisp_Object obj) | 4264 | (Lisp_Object obj) |
| 4240 | { | 4265 | { |
| 4241 | unsigned hash = sxhash (obj, 0); | 4266 | EMACS_UINT hash = sxhash (obj, 0); |
| 4242 | return make_number (hash); | 4267 | return make_number (hash); |
| 4243 | } | 4268 | } |
| 4244 | 4269 | ||
| @@ -4315,17 +4340,16 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4315 | /* Look for `:rehash-size SIZE'. */ | 4340 | /* Look for `:rehash-size SIZE'. */ |
| 4316 | i = get_key_arg (QCrehash_size, nargs, args, used); | 4341 | i = get_key_arg (QCrehash_size, nargs, args, used); |
| 4317 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); | 4342 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); |
| 4318 | if (!NUMBERP (rehash_size) | 4343 | if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size)) |
| 4319 | || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) | 4344 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)))) |
| 4320 | || XFLOATINT (rehash_size) <= 1.0) | ||
| 4321 | signal_error ("Invalid hash table rehash size", rehash_size); | 4345 | signal_error ("Invalid hash table rehash size", rehash_size); |
| 4322 | 4346 | ||
| 4323 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4347 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| 4324 | i = get_key_arg (QCrehash_threshold, nargs, args, used); | 4348 | i = get_key_arg (QCrehash_threshold, nargs, args, used); |
| 4325 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); | 4349 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); |
| 4326 | if (!FLOATP (rehash_threshold) | 4350 | if (! (FLOATP (rehash_threshold) |
| 4327 | || XFLOATINT (rehash_threshold) <= 0.0 | 4351 | && 0 < XFLOAT_DATA (rehash_threshold) |
| 4328 | || XFLOATINT (rehash_threshold) > 1.0) | 4352 | && XFLOAT_DATA (rehash_threshold) <= 1)) |
| 4329 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); | 4353 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); |
| 4330 | 4354 | ||
| 4331 | /* Look for `:weakness WEAK'. */ | 4355 | /* Look for `:weakness WEAK'. */ |
| @@ -4437,7 +4461,7 @@ If KEY is not found, return DFLT which defaults to nil. */) | |||
| 4437 | (Lisp_Object key, Lisp_Object table, Lisp_Object dflt) | 4461 | (Lisp_Object key, Lisp_Object table, Lisp_Object dflt) |
| 4438 | { | 4462 | { |
| 4439 | struct Lisp_Hash_Table *h = check_hash_table (table); | 4463 | struct Lisp_Hash_Table *h = check_hash_table (table); |
| 4440 | int i = hash_lookup (h, key, NULL); | 4464 | EMACS_INT i = hash_lookup (h, key, NULL); |
| 4441 | return i >= 0 ? HASH_VALUE (h, i) : dflt; | 4465 | return i >= 0 ? HASH_VALUE (h, i) : dflt; |
| 4442 | } | 4466 | } |
| 4443 | 4467 | ||
| @@ -4449,8 +4473,8 @@ VALUE. */) | |||
| 4449 | (Lisp_Object key, Lisp_Object value, Lisp_Object table) | 4473 | (Lisp_Object key, Lisp_Object value, Lisp_Object table) |
| 4450 | { | 4474 | { |
| 4451 | struct Lisp_Hash_Table *h = check_hash_table (table); | 4475 | struct Lisp_Hash_Table *h = check_hash_table (table); |
| 4452 | int i; | 4476 | EMACS_INT i; |
| 4453 | unsigned hash; | 4477 | EMACS_UINT hash; |
| 4454 | 4478 | ||
| 4455 | i = hash_lookup (h, key, &hash); | 4479 | i = hash_lookup (h, key, &hash); |
| 4456 | if (i >= 0) | 4480 | if (i >= 0) |
| @@ -4479,7 +4503,7 @@ FUNCTION is called with two arguments, KEY and VALUE. */) | |||
| 4479 | { | 4503 | { |
| 4480 | struct Lisp_Hash_Table *h = check_hash_table (table); | 4504 | struct Lisp_Hash_Table *h = check_hash_table (table); |
| 4481 | Lisp_Object args[3]; | 4505 | Lisp_Object args[3]; |
| 4482 | int i; | 4506 | EMACS_INT i; |
| 4483 | 4507 | ||
| 4484 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 4508 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 4485 | if (!NILP (HASH_HASH (h, i))) | 4509 | if (!NILP (HASH_HASH (h, i))) |
diff --git a/src/frame.c b/src/frame.c index 74e222f85fc..6008ba9567a 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -544,10 +544,8 @@ make_initial_frame (void) | |||
| 544 | /* The default value of menu-bar-mode is t. */ | 544 | /* The default value of menu-bar-mode is t. */ |
| 545 | set_menu_bar_lines (f, make_number (1), Qnil); | 545 | set_menu_bar_lines (f, make_number (1), Qnil); |
| 546 | 546 | ||
| 547 | #ifdef CANNOT_DUMP | ||
| 548 | if (!noninteractive) | 547 | if (!noninteractive) |
| 549 | init_frame_faces (f); | 548 | init_frame_faces (f); |
| 550 | #endif | ||
| 551 | 549 | ||
| 552 | return f; | 550 | return f; |
| 553 | } | 551 | } |
diff --git a/src/image.c b/src/image.c index 0f269f46492..26542bf27e7 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -982,7 +982,6 @@ or omitted means use the selected frame. */) | |||
| 982 | Image type independent image structures | 982 | Image type independent image structures |
| 983 | ***********************************************************************/ | 983 | ***********************************************************************/ |
| 984 | 984 | ||
| 985 | static struct image *make_image (Lisp_Object spec, unsigned hash); | ||
| 986 | static void free_image (struct frame *f, struct image *img); | 985 | static void free_image (struct frame *f, struct image *img); |
| 987 | static int check_image_size (struct frame *f, int width, int height); | 986 | static int check_image_size (struct frame *f, int width, int height); |
| 988 | 987 | ||
| @@ -991,7 +990,7 @@ static int check_image_size (struct frame *f, int width, int height); | |||
| 991 | SPEC. SPEC has a hash value of HASH. */ | 990 | SPEC. SPEC has a hash value of HASH. */ |
| 992 | 991 | ||
| 993 | static struct image * | 992 | static struct image * |
| 994 | make_image (Lisp_Object spec, unsigned int hash) | 993 | make_image (Lisp_Object spec, EMACS_UINT hash) |
| 995 | { | 994 | { |
| 996 | struct image *img = (struct image *) xmalloc (sizeof *img); | 995 | struct image *img = (struct image *) xmalloc (sizeof *img); |
| 997 | Lisp_Object file = image_spec_value (spec, QCfile, NULL); | 996 | Lisp_Object file = image_spec_value (spec, QCfile, NULL); |
| @@ -1388,7 +1387,6 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name, | |||
| 1388 | Image Cache | 1387 | Image Cache |
| 1389 | ***********************************************************************/ | 1388 | ***********************************************************************/ |
| 1390 | 1389 | ||
| 1391 | static struct image *search_image_cache (struct frame *, Lisp_Object, unsigned); | ||
| 1392 | static void cache_image (struct frame *f, struct image *img); | 1390 | static void cache_image (struct frame *f, struct image *img); |
| 1393 | static void postprocess_image (struct frame *, struct image *); | 1391 | static void postprocess_image (struct frame *, struct image *); |
| 1394 | 1392 | ||
| @@ -1414,7 +1412,7 @@ make_image_cache (void) | |||
| 1414 | /* Find an image matching SPEC in the cache, and return it. If no | 1412 | /* Find an image matching SPEC in the cache, and return it. If no |
| 1415 | image is found, return NULL. */ | 1413 | image is found, return NULL. */ |
| 1416 | static struct image * | 1414 | static struct image * |
| 1417 | search_image_cache (struct frame *f, Lisp_Object spec, unsigned int hash) | 1415 | search_image_cache (struct frame *f, Lisp_Object spec, EMACS_UINT hash) |
| 1418 | { | 1416 | { |
| 1419 | struct image *img; | 1417 | struct image *img; |
| 1420 | struct image_cache *c = FRAME_IMAGE_CACHE (f); | 1418 | struct image_cache *c = FRAME_IMAGE_CACHE (f); |
| @@ -1714,7 +1712,7 @@ int | |||
| 1714 | lookup_image (struct frame *f, Lisp_Object spec) | 1712 | lookup_image (struct frame *f, Lisp_Object spec) |
| 1715 | { | 1713 | { |
| 1716 | struct image *img; | 1714 | struct image *img; |
| 1717 | unsigned hash; | 1715 | EMACS_UINT hash; |
| 1718 | EMACS_TIME now; | 1716 | EMACS_TIME now; |
| 1719 | 1717 | ||
| 1720 | /* F must be a window-system frame, and SPEC must be a valid image | 1718 | /* F must be a window-system frame, and SPEC must be a valid image |
| @@ -3751,7 +3749,7 @@ xpm_put_color_table_h (Lisp_Object color_table, | |||
| 3751 | Lisp_Object color) | 3749 | Lisp_Object color) |
| 3752 | { | 3750 | { |
| 3753 | struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); | 3751 | struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); |
| 3754 | unsigned hash_code; | 3752 | EMACS_UINT hash_code; |
| 3755 | Lisp_Object chars = make_unibyte_string (chars_start, chars_len); | 3753 | Lisp_Object chars = make_unibyte_string (chars_start, chars_len); |
| 3756 | 3754 | ||
| 3757 | hash_lookup (table, chars, &hash_code); | 3755 | hash_lookup (table, chars, &hash_code); |
diff --git a/src/lisp.h b/src/lisp.h index 8df4b67bb45..a9e7354f9fc 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -525,23 +525,21 @@ extern Lisp_Object make_number (EMACS_INT); | |||
| 525 | 525 | ||
| 526 | #define EQ(x, y) (XHASH (x) == XHASH (y)) | 526 | #define EQ(x, y) (XHASH (x) == XHASH (y)) |
| 527 | 527 | ||
| 528 | /* Largest and smallest representable fixnum values. These are the C | 528 | /* Number of bits in a fixnum, including the sign bit. */ |
| 529 | values. */ | ||
| 530 | |||
| 531 | #ifdef USE_2_TAGS_FOR_INTS | 529 | #ifdef USE_2_TAGS_FOR_INTS |
| 532 | # define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << VALBITS) | 530 | # define FIXNUM_BITS (VALBITS + 1) |
| 533 | # define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << VALBITS) - 1) | ||
| 534 | /* Mask indicating the significant bits of a Lisp_Int. | ||
| 535 | I.e. (x & INTMASK) == XUINT (make_number (x)). */ | ||
| 536 | # define INTMASK ((((EMACS_INT) 1) << (VALBITS + 1)) - 1) | ||
| 537 | #else | 531 | #else |
| 538 | # define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1)) | 532 | # define FIXNUM_BITS VALBITS |
| 539 | # define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1) | ||
| 540 | /* Mask indicating the significant bits of a Lisp_Int. | ||
| 541 | I.e. (x & INTMASK) == XUINT (make_number (x)). */ | ||
| 542 | # define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1) | ||
| 543 | #endif | 533 | #endif |
| 544 | 534 | ||
| 535 | /* Mask indicating the significant bits of a fixnum. */ | ||
| 536 | #define INTMASK (((EMACS_INT) 1 << FIXNUM_BITS) - 1) | ||
| 537 | |||
| 538 | /* Largest and smallest representable fixnum values. These are the C | ||
| 539 | values. */ | ||
| 540 | #define MOST_POSITIVE_FIXNUM (INTMASK / 2) | ||
| 541 | #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM) | ||
| 542 | |||
| 545 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is | 543 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is |
| 546 | written this way so that it also works if I is of unsigned | 544 | written this way so that it also works if I is of unsigned |
| 547 | type or if I is a NaN. */ | 545 | type or if I is a NaN. */ |
| @@ -1179,7 +1177,7 @@ struct Lisp_Hash_Table | |||
| 1179 | a special way (e.g. because of weakness). */ | 1177 | a special way (e.g. because of weakness). */ |
| 1180 | 1178 | ||
| 1181 | /* Number of key/value entries in the table. */ | 1179 | /* Number of key/value entries in the table. */ |
| 1182 | unsigned int count; | 1180 | EMACS_INT count; |
| 1183 | 1181 | ||
| 1184 | /* Vector of keys and values. The key of item I is found at index | 1182 | /* Vector of keys and values. The key of item I is found at index |
| 1185 | 2 * I, the value is found at index 2 * I + 1. | 1183 | 2 * I, the value is found at index 2 * I + 1. |
| @@ -1191,11 +1189,12 @@ struct Lisp_Hash_Table | |||
| 1191 | struct Lisp_Hash_Table *next_weak; | 1189 | struct Lisp_Hash_Table *next_weak; |
| 1192 | 1190 | ||
| 1193 | /* C function to compare two keys. */ | 1191 | /* C function to compare two keys. */ |
| 1194 | int (* cmpfn) (struct Lisp_Hash_Table *, Lisp_Object, | 1192 | int (*cmpfn) (struct Lisp_Hash_Table *, |
| 1195 | unsigned, Lisp_Object, unsigned); | 1193 | Lisp_Object, EMACS_UINT, |
| 1194 | Lisp_Object, EMACS_UINT); | ||
| 1196 | 1195 | ||
| 1197 | /* C function to compute hash code. */ | 1196 | /* C function to compute hash code. */ |
| 1198 | unsigned (* hashfn) (struct Lisp_Hash_Table *, Lisp_Object); | 1197 | EMACS_UINT (*hashfn) (struct Lisp_Hash_Table *, Lisp_Object); |
| 1199 | }; | 1198 | }; |
| 1200 | 1199 | ||
| 1201 | 1200 | ||
| @@ -2093,7 +2092,7 @@ extern Lisp_Object Vascii_canon_table; | |||
| 2093 | 2092 | ||
| 2094 | /* Number of bytes of structure consed since last GC. */ | 2093 | /* Number of bytes of structure consed since last GC. */ |
| 2095 | 2094 | ||
| 2096 | extern int consing_since_gc; | 2095 | extern EMACS_INT consing_since_gc; |
| 2097 | 2096 | ||
| 2098 | extern EMACS_INT gc_relative_threshold; | 2097 | extern EMACS_INT gc_relative_threshold; |
| 2099 | 2098 | ||
| @@ -2468,19 +2467,19 @@ extern void syms_of_syntax (void); | |||
| 2468 | 2467 | ||
| 2469 | /* Defined in fns.c */ | 2468 | /* Defined in fns.c */ |
| 2470 | extern Lisp_Object QCrehash_size, QCrehash_threshold; | 2469 | extern Lisp_Object QCrehash_size, QCrehash_threshold; |
| 2471 | extern int next_almost_prime (int); | 2470 | extern EMACS_INT next_almost_prime (EMACS_INT); |
| 2472 | extern Lisp_Object larger_vector (Lisp_Object, int, Lisp_Object); | 2471 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); |
| 2473 | extern void sweep_weak_hash_tables (void); | 2472 | extern void sweep_weak_hash_tables (void); |
| 2474 | extern Lisp_Object Qcursor_in_echo_area; | 2473 | extern Lisp_Object Qcursor_in_echo_area; |
| 2475 | extern Lisp_Object Qstring_lessp; | 2474 | extern Lisp_Object Qstring_lessp; |
| 2476 | extern Lisp_Object QCsize, QCtest, QCweakness, Qequal, Qeq, Qeql; | 2475 | extern Lisp_Object QCsize, QCtest, QCweakness, Qequal, Qeq, Qeql; |
| 2477 | unsigned sxhash (Lisp_Object, int); | 2476 | EMACS_UINT sxhash (Lisp_Object, int); |
| 2478 | Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, | 2477 | Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object, |
| 2479 | Lisp_Object, Lisp_Object, Lisp_Object, | 2478 | Lisp_Object, Lisp_Object, Lisp_Object, |
| 2480 | Lisp_Object); | 2479 | Lisp_Object); |
| 2481 | int hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, unsigned *); | 2480 | EMACS_INT hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); |
| 2482 | int hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, | 2481 | EMACS_INT hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, |
| 2483 | unsigned); | 2482 | EMACS_UINT); |
| 2484 | void init_weak_hash_tables (void); | 2483 | void init_weak_hash_tables (void); |
| 2485 | extern void init_fns (void); | 2484 | extern void init_fns (void); |
| 2486 | EXFUN (Fmake_hash_table, MANY); | 2485 | EXFUN (Fmake_hash_table, MANY); |
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 060b565b308..8da589a7115 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -654,6 +654,7 @@ $(BLD)/data.$(O) : \ | |||
| 654 | $(SRC)/data.c \ | 654 | $(SRC)/data.c \ |
| 655 | $(CONFIG_H) \ | 655 | $(CONFIG_H) \ |
| 656 | $(EMACS_ROOT)/nt/inc/sys/time.h \ | 656 | $(EMACS_ROOT)/nt/inc/sys/time.h \ |
| 657 | $(EMACS_ROOT)/lib/intprops.h \ | ||
| 657 | $(LISP_H) \ | 658 | $(LISP_H) \ |
| 658 | $(SRC)/buffer.h \ | 659 | $(SRC)/buffer.h \ |
| 659 | $(SRC)/ccl.h \ | 660 | $(SRC)/ccl.h \ |
| @@ -753,6 +754,7 @@ $(BLD)/editfns.$(O) : \ | |||
| 753 | $(EMACS_ROOT)/nt/inc/sys/time.h \ | 754 | $(EMACS_ROOT)/nt/inc/sys/time.h \ |
| 754 | $(EMACS_ROOT)/lib/intprops.h \ | 755 | $(EMACS_ROOT)/lib/intprops.h \ |
| 755 | $(EMACS_ROOT)/lib/strftime.h \ | 756 | $(EMACS_ROOT)/lib/strftime.h \ |
| 757 | $(EMACS_ROOT)/lib/verify.h \ | ||
| 756 | $(LISP_H) \ | 758 | $(LISP_H) \ |
| 757 | $(SRC)/atimer.h \ | 759 | $(SRC)/atimer.h \ |
| 758 | $(SRC)/blockinput.h \ | 760 | $(SRC)/blockinput.h \ |
diff --git a/src/minibuf.c b/src/minibuf.c index 0c28dd91546..ba8729bdff2 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -160,7 +160,7 @@ without invoking the usual minibuffer commands. */) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | /* Actual minibuffer invocation. */ | 163 | /* Actual minibuffer invocation. */ |
| 164 | 164 | ||
| 165 | static Lisp_Object read_minibuf_unwind (Lisp_Object); | 165 | static Lisp_Object read_minibuf_unwind (Lisp_Object); |
| 166 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); | 166 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); |
| @@ -266,7 +266,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 266 | error ("Error reading from stdin"); | 266 | error ("Error reading from stdin"); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | /* If Lisp form desired instead of string, parse it. */ | 269 | /* If Lisp form desired instead of string, parse it. */ |
| 270 | if (expflag) | 270 | if (expflag) |
| 271 | val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt); | 271 | val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt); |
| 272 | 272 | ||
| @@ -743,7 +743,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 743 | } | 743 | } |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | /* If Lisp form desired instead of string, parse it. */ | 746 | /* If Lisp form desired instead of string, parse it. */ |
| 747 | if (expflag) | 747 | if (expflag) |
| 748 | val = string_to_object (val, defalt); | 748 | val = string_to_object (val, defalt); |
| 749 | 749 | ||
| @@ -755,7 +755,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 755 | 755 | ||
| 756 | /* Return a buffer to be used as the minibuffer at depth `depth'. | 756 | /* Return a buffer to be used as the minibuffer at depth `depth'. |
| 757 | depth = 0 is the lowest allowed argument, and that is the value | 757 | depth = 0 is the lowest allowed argument, and that is the value |
| 758 | used for nonrecursive minibuffer invocations */ | 758 | used for nonrecursive minibuffer invocations. */ |
| 759 | 759 | ||
| 760 | Lisp_Object | 760 | Lisp_Object |
| 761 | get_minibuffer (int depth) | 761 | get_minibuffer (int depth) |
| @@ -793,7 +793,10 @@ get_minibuffer (int depth) | |||
| 793 | reset_buffer (XBUFFER (buf)); | 793 | reset_buffer (XBUFFER (buf)); |
| 794 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 794 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
| 795 | Fset_buffer (buf); | 795 | Fset_buffer (buf); |
| 796 | Fkill_all_local_variables (); | 796 | if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) |
| 797 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 798 | else | ||
| 799 | Fkill_all_local_variables (); | ||
| 797 | unbind_to (count, Qnil); | 800 | unbind_to (count, Qnil); |
| 798 | } | 801 | } |
| 799 | 802 | ||
| @@ -808,7 +811,7 @@ run_exit_minibuf_hook (Lisp_Object data) | |||
| 808 | } | 811 | } |
| 809 | 812 | ||
| 810 | /* This function is called on exiting minibuffer, whether normally or | 813 | /* This function is called on exiting minibuffer, whether normally or |
| 811 | not, and it restores the current window, buffer, etc. */ | 814 | not, and it restores the current window, buffer, etc. */ |
| 812 | 815 | ||
| 813 | static Lisp_Object | 816 | static Lisp_Object |
| 814 | read_minibuf_unwind (Lisp_Object data) | 817 | read_minibuf_unwind (Lisp_Object data) |
| @@ -868,6 +871,12 @@ read_minibuf_unwind (Lisp_Object data) | |||
| 868 | windows_or_buffers_changed++; | 871 | windows_or_buffers_changed++; |
| 869 | XSETFASTINT (XWINDOW (window)->last_modified, 0); | 872 | XSETFASTINT (XWINDOW (window)->last_modified, 0); |
| 870 | XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); | 873 | XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); |
| 874 | |||
| 875 | /* In case the previous minibuffer displayed in this miniwindow is | ||
| 876 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, | ||
| 877 | to make sure we don't leave around bindings and stuff which only | ||
| 878 | made sense during the read_minibuf invocation. */ | ||
| 879 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 871 | return Qnil; | 880 | return Qnil; |
| 872 | } | 881 | } |
| 873 | 882 | ||
| @@ -978,7 +987,7 @@ Such arguments are used as in `read-from-minibuffer'.) */) | |||
| 978 | Qnil); | 987 | Qnil); |
| 979 | } | 988 | } |
| 980 | 989 | ||
| 981 | /* Functions that use the minibuffer to read various things. */ | 990 | /* Functions that use the minibuffer to read various things. */ |
| 982 | 991 | ||
| 983 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, | 992 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, |
| 984 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 993 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| @@ -1146,7 +1155,7 @@ function, instead of the usual behavior. */) | |||
| 1146 | args[1] = prompt; | 1155 | args[1] = prompt; |
| 1147 | args[2] = def; | 1156 | args[2] = def; |
| 1148 | args[3] = require_match; | 1157 | args[3] = require_match; |
| 1149 | result = Ffuncall(4, args); | 1158 | result = Ffuncall (4, args); |
| 1150 | } | 1159 | } |
| 1151 | return unbind_to (count, result); | 1160 | return unbind_to (count, result); |
| 1152 | } | 1161 | } |
| @@ -1209,7 +1218,7 @@ is used to further constrain the set of candidates. */) | |||
| 1209 | && (!SYMBOLP (XCAR (collection)) | 1218 | && (!SYMBOLP (XCAR (collection)) |
| 1210 | || NILP (XCAR (collection))))) | 1219 | || NILP (XCAR (collection))))) |
| 1211 | ? list_table : function_table)); | 1220 | ? list_table : function_table)); |
| 1212 | int idx = 0, obsize = 0; | 1221 | EMACS_INT idx = 0, obsize = 0; |
| 1213 | int matchcount = 0; | 1222 | int matchcount = 0; |
| 1214 | int bindcount = -1; | 1223 | int bindcount = -1; |
| 1215 | Lisp_Object bucket, zero, end, tem; | 1224 | Lisp_Object bucket, zero, end, tem; |
| @@ -1233,10 +1242,10 @@ is used to further constrain the set of candidates. */) | |||
| 1233 | 1242 | ||
| 1234 | while (1) | 1243 | while (1) |
| 1235 | { | 1244 | { |
| 1236 | /* Get the next element of the alist, obarray, or hash-table. */ | 1245 | /* Get the next element of the alist, obarray, or hash-table. */ |
| 1237 | /* Exit the loop if the elements are all used up. */ | 1246 | /* Exit the loop if the elements are all used up. */ |
| 1238 | /* elt gets the alist element or symbol. | 1247 | /* elt gets the alist element or symbol. |
| 1239 | eltstring gets the name to check as a completion. */ | 1248 | eltstring gets the name to check as a completion. */ |
| 1240 | 1249 | ||
| 1241 | if (type == list_table) | 1250 | if (type == list_table) |
| 1242 | { | 1251 | { |
| @@ -1278,7 +1287,7 @@ is used to further constrain the set of candidates. */) | |||
| 1278 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); | 1287 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); |
| 1279 | } | 1288 | } |
| 1280 | 1289 | ||
| 1281 | /* Is this element a possible completion? */ | 1290 | /* Is this element a possible completion? */ |
| 1282 | 1291 | ||
| 1283 | if (SYMBOLP (eltstring)) | 1292 | if (SYMBOLP (eltstring)) |
| 1284 | eltstring = Fsymbol_name (eltstring); | 1293 | eltstring = Fsymbol_name (eltstring); |
| @@ -1291,7 +1300,7 @@ is used to further constrain the set of candidates. */) | |||
| 1291 | completion_ignore_case ? Qt : Qnil), | 1300 | completion_ignore_case ? Qt : Qnil), |
| 1292 | EQ (Qt, tem))) | 1301 | EQ (Qt, tem))) |
| 1293 | { | 1302 | { |
| 1294 | /* Yes. */ | 1303 | /* Yes. */ |
| 1295 | Lisp_Object regexps; | 1304 | Lisp_Object regexps; |
| 1296 | 1305 | ||
| 1297 | /* Ignore this element if it fails to match all the regexps. */ | 1306 | /* Ignore this element if it fails to match all the regexps. */ |
| @@ -1313,7 +1322,7 @@ is used to further constrain the set of candidates. */) | |||
| 1313 | } | 1322 | } |
| 1314 | 1323 | ||
| 1315 | /* Ignore this element if there is a predicate | 1324 | /* Ignore this element if there is a predicate |
| 1316 | and the predicate doesn't like it. */ | 1325 | and the predicate doesn't like it. */ |
| 1317 | 1326 | ||
| 1318 | if (!NILP (predicate)) | 1327 | if (!NILP (predicate)) |
| 1319 | { | 1328 | { |
| @@ -1415,7 +1424,7 @@ is used to further constrain the set of candidates. */) | |||
| 1415 | } | 1424 | } |
| 1416 | 1425 | ||
| 1417 | if (NILP (bestmatch)) | 1426 | if (NILP (bestmatch)) |
| 1418 | return Qnil; /* No completions found */ | 1427 | return Qnil; /* No completions found. */ |
| 1419 | /* If we are ignoring case, and there is no exact match, | 1428 | /* If we are ignoring case, and there is no exact match, |
| 1420 | and no additional text was supplied, | 1429 | and no additional text was supplied, |
| 1421 | don't change the case of what the user typed. */ | 1430 | don't change the case of what the user typed. */ |
| @@ -1429,7 +1438,7 @@ is used to further constrain the set of candidates. */) | |||
| 1429 | return Qt; | 1438 | return Qt; |
| 1430 | 1439 | ||
| 1431 | XSETFASTINT (zero, 0); /* Else extract the part in which */ | 1440 | XSETFASTINT (zero, 0); /* Else extract the part in which */ |
| 1432 | XSETFASTINT (end, bestmatchsize); /* all completions agree */ | 1441 | XSETFASTINT (end, bestmatchsize); /* all completions agree. */ |
| 1433 | return Fsubstring (bestmatch, zero, end); | 1442 | return Fsubstring (bestmatch, zero, end); |
| 1434 | } | 1443 | } |
| 1435 | 1444 | ||
| @@ -1474,7 +1483,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1474 | : NILP (collection) || (CONSP (collection) | 1483 | : NILP (collection) || (CONSP (collection) |
| 1475 | && (!SYMBOLP (XCAR (collection)) | 1484 | && (!SYMBOLP (XCAR (collection)) |
| 1476 | || NILP (XCAR (collection)))); | 1485 | || NILP (XCAR (collection)))); |
| 1477 | int idx = 0, obsize = 0; | 1486 | EMACS_INT idx = 0, obsize = 0; |
| 1478 | int bindcount = -1; | 1487 | int bindcount = -1; |
| 1479 | Lisp_Object bucket, tem, zero; | 1488 | Lisp_Object bucket, tem, zero; |
| 1480 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1489 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| @@ -1496,10 +1505,10 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1496 | 1505 | ||
| 1497 | while (1) | 1506 | while (1) |
| 1498 | { | 1507 | { |
| 1499 | /* Get the next element of the alist, obarray, or hash-table. */ | 1508 | /* Get the next element of the alist, obarray, or hash-table. */ |
| 1500 | /* Exit the loop if the elements are all used up. */ | 1509 | /* Exit the loop if the elements are all used up. */ |
| 1501 | /* elt gets the alist element or symbol. | 1510 | /* elt gets the alist element or symbol. |
| 1502 | eltstring gets the name to check as a completion. */ | 1511 | eltstring gets the name to check as a completion. */ |
| 1503 | 1512 | ||
| 1504 | if (type == 1) | 1513 | if (type == 1) |
| 1505 | { | 1514 | { |
| @@ -1541,7 +1550,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1541 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); | 1550 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); |
| 1542 | } | 1551 | } |
| 1543 | 1552 | ||
| 1544 | /* Is this element a possible completion? */ | 1553 | /* Is this element a possible completion? */ |
| 1545 | 1554 | ||
| 1546 | if (SYMBOLP (eltstring)) | 1555 | if (SYMBOLP (eltstring)) |
| 1547 | eltstring = Fsymbol_name (eltstring); | 1556 | eltstring = Fsymbol_name (eltstring); |
| @@ -1561,7 +1570,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1561 | completion_ignore_case ? Qt : Qnil), | 1570 | completion_ignore_case ? Qt : Qnil), |
| 1562 | EQ (Qt, tem))) | 1571 | EQ (Qt, tem))) |
| 1563 | { | 1572 | { |
| 1564 | /* Yes. */ | 1573 | /* Yes. */ |
| 1565 | Lisp_Object regexps; | 1574 | Lisp_Object regexps; |
| 1566 | 1575 | ||
| 1567 | /* Ignore this element if it fails to match all the regexps. */ | 1576 | /* Ignore this element if it fails to match all the regexps. */ |
| @@ -1583,7 +1592,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1583 | } | 1592 | } |
| 1584 | 1593 | ||
| 1585 | /* Ignore this element if there is a predicate | 1594 | /* Ignore this element if there is a predicate |
| 1586 | and the predicate doesn't like it. */ | 1595 | and the predicate doesn't like it. */ |
| 1587 | 1596 | ||
| 1588 | if (!NILP (predicate)) | 1597 | if (!NILP (predicate)) |
| 1589 | { | 1598 | { |
| @@ -1604,7 +1613,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1604 | } | 1613 | } |
| 1605 | if (NILP (tem)) continue; | 1614 | if (NILP (tem)) continue; |
| 1606 | } | 1615 | } |
| 1607 | /* Ok => put it on the list. */ | 1616 | /* Ok => put it on the list. */ |
| 1608 | allmatches = Fcons (eltstring, allmatches); | 1617 | allmatches = Fcons (eltstring, allmatches); |
| 1609 | } | 1618 | } |
| 1610 | } | 1619 | } |
| @@ -1770,7 +1779,7 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1770 | (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate) | 1779 | (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate) |
| 1771 | { | 1780 | { |
| 1772 | Lisp_Object regexps, tail, tem = Qnil; | 1781 | Lisp_Object regexps, tail, tem = Qnil; |
| 1773 | int i = 0; | 1782 | EMACS_INT i = 0; |
| 1774 | 1783 | ||
| 1775 | CHECK_STRING (string); | 1784 | CHECK_STRING (string); |
| 1776 | 1785 | ||
| @@ -1810,9 +1819,9 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1810 | if (SYMBOLP (tail)) | 1819 | if (SYMBOLP (tail)) |
| 1811 | while (1) | 1820 | while (1) |
| 1812 | { | 1821 | { |
| 1813 | if (EQ((Fcompare_strings (string, make_number (0), Qnil, | 1822 | if (EQ (Fcompare_strings (string, make_number (0), Qnil, |
| 1814 | Fsymbol_name (tail), | 1823 | Fsymbol_name (tail), |
| 1815 | make_number (0) , Qnil, Qt)), | 1824 | make_number (0) , Qnil, Qt), |
| 1816 | Qt)) | 1825 | Qt)) |
| 1817 | { | 1826 | { |
| 1818 | tem = tail; | 1827 | tem = tail; |
| @@ -1836,11 +1845,11 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1836 | tem = HASH_KEY (h, i); | 1845 | tem = HASH_KEY (h, i); |
| 1837 | else | 1846 | else |
| 1838 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 1847 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 1839 | if (!NILP (HASH_HASH (h, i)) && | 1848 | if (!NILP (HASH_HASH (h, i)) |
| 1840 | EQ (Fcompare_strings (string, make_number (0), Qnil, | 1849 | && EQ (Fcompare_strings (string, make_number (0), Qnil, |
| 1841 | HASH_KEY (h, i), make_number (0) , Qnil, | 1850 | HASH_KEY (h, i), make_number (0) , Qnil, |
| 1842 | completion_ignore_case ? Qt : Qnil), | 1851 | completion_ignore_case ? Qt : Qnil), |
| 1843 | Qt)) | 1852 | Qt)) |
| 1844 | { | 1853 | { |
| 1845 | tem = HASH_KEY (h, i); | 1854 | tem = HASH_KEY (h, i); |
| 1846 | break; | 1855 | break; |
| @@ -1887,7 +1896,7 @@ If the argument FLAG is nil, invoke `try-completion', if it's t, invoke | |||
| 1887 | `all-completions', otherwise invoke `test-completion'. | 1896 | `all-completions', otherwise invoke `test-completion'. |
| 1888 | 1897 | ||
| 1889 | The arguments STRING and PREDICATE are as in `try-completion', | 1898 | The arguments STRING and PREDICATE are as in `try-completion', |
| 1890 | `all-completions', and `test-completion'. */) | 1899 | `all-completions', and `test-completion'. */) |
| 1891 | (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag) | 1900 | (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag) |
| 1892 | { | 1901 | { |
| 1893 | if (NILP (flag)) | 1902 | if (NILP (flag)) |
diff --git a/src/print.c b/src/print.c index 20c3e8ae526..803e3a17214 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1082,7 +1082,7 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) | |||
| 1082 | Maybe a better way to do that is to copy elements to | 1082 | Maybe a better way to do that is to copy elements to |
| 1083 | a new hash table. */ | 1083 | a new hash table. */ |
| 1084 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table); | 1084 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table); |
| 1085 | int i; | 1085 | EMACS_INT i; |
| 1086 | 1086 | ||
| 1087 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 1087 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 1088 | if (!NILP (HASH_HASH (h, i)) | 1088 | if (!NILP (HASH_HASH (h, i)) |