diff options
| author | Gerd Moellmann | 2000-08-05 15:48:22 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-05 15:48:22 +0000 |
| commit | 1fd4c450e5273aed82a8d643ad8cdffd4b156280 (patch) | |
| tree | 88aab9299da57f16c2a67efc9ace47ac893298a1 /src/fns.c | |
| parent | 1a948b17948fffafe6022c0152dba0dc5cc84cef (diff) | |
| download | emacs-1fd4c450e5273aed82a8d643ad8cdffd4b156280.tar.gz emacs-1fd4c450e5273aed82a8d643ad8cdffd4b156280.zip | |
Replace `illegal' with `invalid'.
(Fmake_hash_table, amke_hash_table): Allow table size of 0.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 21 |
1 files changed, 12 insertions, 9 deletions
| @@ -3910,7 +3910,7 @@ hashfn_user_defined (h, key) | |||
| 3910 | hash = Ffuncall (2, args); | 3910 | hash = Ffuncall (2, args); |
| 3911 | if (!INTEGERP (hash)) | 3911 | if (!INTEGERP (hash)) |
| 3912 | Fsignal (Qerror, | 3912 | Fsignal (Qerror, |
| 3913 | list2 (build_string ("Illegal hash code returned from \ | 3913 | list2 (build_string ("Invalid hash code returned from \ |
| 3914 | user-supplied hash function"), | 3914 | user-supplied hash function"), |
| 3915 | hash)); | 3915 | hash)); |
| 3916 | return XUINT (hash); | 3916 | return XUINT (hash); |
| @@ -3924,7 +3924,7 @@ user-supplied hash function"), | |||
| 3924 | `equal' or a symbol denoting a user-defined test named TEST with | 3924 | `equal' or a symbol denoting a user-defined test named TEST with |
| 3925 | test and hash functions USER_TEST and USER_HASH. | 3925 | test and hash functions USER_TEST and USER_HASH. |
| 3926 | 3926 | ||
| 3927 | Give the table initial capacity SIZE, SIZE > 0, an integer. | 3927 | Give the table initial capacity SIZE, SIZE >= 0, an integer. |
| 3928 | 3928 | ||
| 3929 | If REHASH_SIZE is an integer, it must be > 0, and this hash table's | 3929 | If REHASH_SIZE is an integer, it must be > 0, and this hash table's |
| 3930 | new size when it becomes full is computed by adding REHASH_SIZE to | 3930 | new size when it becomes full is computed by adding REHASH_SIZE to |
| @@ -3952,13 +3952,16 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak, | |||
| 3952 | 3952 | ||
| 3953 | /* Preconditions. */ | 3953 | /* Preconditions. */ |
| 3954 | xassert (SYMBOLP (test)); | 3954 | xassert (SYMBOLP (test)); |
| 3955 | xassert (INTEGERP (size) && XINT (size) > 0); | 3955 | xassert (INTEGERP (size) && XINT (size) >= 0); |
| 3956 | xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 3956 | xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) |
| 3957 | || (FLOATP (rehash_size) && XFLOATINT (rehash_size) > 1.0)); | 3957 | || (FLOATP (rehash_size) && XFLOATINT (rehash_size) > 1.0)); |
| 3958 | xassert (FLOATP (rehash_threshold) | 3958 | xassert (FLOATP (rehash_threshold) |
| 3959 | && XFLOATINT (rehash_threshold) > 0 | 3959 | && XFLOATINT (rehash_threshold) > 0 |
| 3960 | && XFLOATINT (rehash_threshold) <= 1.0); | 3960 | && XFLOATINT (rehash_threshold) <= 1.0); |
| 3961 | 3961 | ||
| 3962 | if (XFASTINT (size) == 0) | ||
| 3963 | size = make_number (1); | ||
| 3964 | |||
| 3962 | /* Allocate a vector, and initialize it. */ | 3965 | /* Allocate a vector, and initialize it. */ |
| 3963 | len = VECSIZE (struct Lisp_Hash_Table); | 3966 | len = VECSIZE (struct Lisp_Hash_Table); |
| 3964 | v = allocate_vectorlike (len); | 3967 | v = allocate_vectorlike (len); |
| @@ -4669,7 +4672,7 @@ to `key-and-value'. Default value of WEAK is nil.") | |||
| 4669 | 4672 | ||
| 4670 | prop = Fget (test, Qhash_table_test); | 4673 | prop = Fget (test, Qhash_table_test); |
| 4671 | if (!CONSP (prop) || XFASTINT (Flength (prop)) < 2) | 4674 | if (!CONSP (prop) || XFASTINT (Flength (prop)) < 2) |
| 4672 | Fsignal (Qerror, list2 (build_string ("Illegal hash table test"), | 4675 | Fsignal (Qerror, list2 (build_string ("Invalid hash table test"), |
| 4673 | test)); | 4676 | test)); |
| 4674 | user_test = Fnth (make_number (0), prop); | 4677 | user_test = Fnth (make_number (0), prop); |
| 4675 | user_hash = Fnth (make_number (1), prop); | 4678 | user_hash = Fnth (make_number (1), prop); |
| @@ -4680,9 +4683,9 @@ to `key-and-value'. Default value of WEAK is nil.") | |||
| 4680 | /* See if there's a `:size SIZE' argument. */ | 4683 | /* See if there's a `:size SIZE' argument. */ |
| 4681 | i = get_key_arg (QCsize, nargs, args, used); | 4684 | i = get_key_arg (QCsize, nargs, args, used); |
| 4682 | size = i < 0 ? make_number (DEFAULT_HASH_SIZE) : args[i]; | 4685 | size = i < 0 ? make_number (DEFAULT_HASH_SIZE) : args[i]; |
| 4683 | if (!INTEGERP (size) || XINT (size) <= 0) | 4686 | if (!INTEGERP (size) || XINT (size) < 0) |
| 4684 | Fsignal (Qerror, | 4687 | Fsignal (Qerror, |
| 4685 | list2 (build_string ("Illegal hash table size"), | 4688 | list2 (build_string ("Invalid hash table size"), |
| 4686 | size)); | 4689 | size)); |
| 4687 | 4690 | ||
| 4688 | /* Look for `:rehash-size SIZE'. */ | 4691 | /* Look for `:rehash-size SIZE'. */ |
| @@ -4692,7 +4695,7 @@ to `key-and-value'. Default value of WEAK is nil.") | |||
| 4692 | || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) | 4695 | || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) |
| 4693 | || XFLOATINT (rehash_size) <= 1.0) | 4696 | || XFLOATINT (rehash_size) <= 1.0) |
| 4694 | Fsignal (Qerror, | 4697 | Fsignal (Qerror, |
| 4695 | list2 (build_string ("Illegal hash table rehash size"), | 4698 | list2 (build_string ("Invalid hash table rehash size"), |
| 4696 | rehash_size)); | 4699 | rehash_size)); |
| 4697 | 4700 | ||
| 4698 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4701 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| @@ -4702,7 +4705,7 @@ to `key-and-value'. Default value of WEAK is nil.") | |||
| 4702 | || XFLOATINT (rehash_threshold) <= 0.0 | 4705 | || XFLOATINT (rehash_threshold) <= 0.0 |
| 4703 | || XFLOATINT (rehash_threshold) > 1.0) | 4706 | || XFLOATINT (rehash_threshold) > 1.0) |
| 4704 | Fsignal (Qerror, | 4707 | Fsignal (Qerror, |
| 4705 | list2 (build_string ("Illegal hash table rehash threshold"), | 4708 | list2 (build_string ("Invalid hash table rehash threshold"), |
| 4706 | rehash_threshold)); | 4709 | rehash_threshold)); |
| 4707 | 4710 | ||
| 4708 | /* Look for `:weakness WEAK'. */ | 4711 | /* Look for `:weakness WEAK'. */ |
| @@ -4715,7 +4718,7 @@ to `key-and-value'. Default value of WEAK is nil.") | |||
| 4715 | && !EQ (weak, Qvalue) | 4718 | && !EQ (weak, Qvalue) |
| 4716 | && !EQ (weak, Qkey_or_value) | 4719 | && !EQ (weak, Qkey_or_value) |
| 4717 | && !EQ (weak, Qkey_and_value)) | 4720 | && !EQ (weak, Qkey_and_value)) |
| 4718 | Fsignal (Qerror, list2 (build_string ("Illegal hash table weakness"), | 4721 | Fsignal (Qerror, list2 (build_string ("Invalid hash table weakness"), |
| 4719 | weak)); | 4722 | weak)); |
| 4720 | 4723 | ||
| 4721 | /* Now, all args should have been used up, or there's a problem. */ | 4724 | /* Now, all args should have been used up, or there's a problem. */ |