Commit 1fd4c450 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

Replace `illegal' with `invalid'.

(Fmake_hash_table, amke_hash_table): Allow table size of 0.
parent 1a948b17
2000-08-05 Gerd Moellmann <gerd@gnu.org>
* xfaces.c, xfns.c, w32fns.c: Replace `illegal' with `invalid'.
* fns.c: Replace `illegal' with `invalid'.
(Fmake_hash_table, amke_hash_table): Allow table size of 0.
2000-08-05 Kenichi Handa <handa@etl.go.jp> 2000-08-05 Kenichi Handa <handa@etl.go.jp>
   
* syntax.c (skip_chars): Fix handling of multibyte<->unibyte * syntax.c (skip_chars): Fix handling of multibyte<->unibyte
......
...@@ -3910,7 +3910,7 @@ hashfn_user_defined (h, key) ...@@ -3910,7 +3910,7 @@ hashfn_user_defined (h, key)
hash = Ffuncall (2, args); hash = Ffuncall (2, args);
if (!INTEGERP (hash)) if (!INTEGERP (hash))
Fsignal (Qerror, Fsignal (Qerror,
list2 (build_string ("Illegal hash code returned from \ list2 (build_string ("Invalid hash code returned from \
user-supplied hash function"), user-supplied hash function"),
hash)); hash));
return XUINT (hash); return XUINT (hash);
...@@ -3924,7 +3924,7 @@ user-supplied hash function"), ...@@ -3924,7 +3924,7 @@ user-supplied hash function"),
`equal' or a symbol denoting a user-defined test named TEST with `equal' or a symbol denoting a user-defined test named TEST with
test and hash functions USER_TEST and USER_HASH. test and hash functions USER_TEST and USER_HASH.
Give the table initial capacity SIZE, SIZE > 0, an integer. Give the table initial capacity SIZE, SIZE >= 0, an integer.
If REHASH_SIZE is an integer, it must be > 0, and this hash table's If REHASH_SIZE is an integer, it must be > 0, and this hash table's
new size when it becomes full is computed by adding REHASH_SIZE to 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,13 +3952,16 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
/* Preconditions. */ /* Preconditions. */
xassert (SYMBOLP (test)); xassert (SYMBOLP (test));
xassert (INTEGERP (size) && XINT (size) > 0); xassert (INTEGERP (size) && XINT (size) >= 0);
xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
|| (FLOATP (rehash_size) && XFLOATINT (rehash_size) > 1.0)); || (FLOATP (rehash_size) && XFLOATINT (rehash_size) > 1.0));
xassert (FLOATP (rehash_threshold) xassert (FLOATP (rehash_threshold)
&& XFLOATINT (rehash_threshold) > 0 && XFLOATINT (rehash_threshold) > 0
&& XFLOATINT (rehash_threshold) <= 1.0); && XFLOATINT (rehash_threshold) <= 1.0);
if (XFASTINT (size) == 0)
size = make_number (1);
/* Allocate a vector, and initialize it. */ /* Allocate a vector, and initialize it. */
len = VECSIZE (struct Lisp_Hash_Table); len = VECSIZE (struct Lisp_Hash_Table);
v = allocate_vectorlike (len); v = allocate_vectorlike (len);
...@@ -4669,7 +4672,7 @@ to `key-and-value'. Default value of WEAK is nil.") ...@@ -4669,7 +4672,7 @@ to `key-and-value'. Default value of WEAK is nil.")
prop = Fget (test, Qhash_table_test); prop = Fget (test, Qhash_table_test);
if (!CONSP (prop) || XFASTINT (Flength (prop)) < 2) if (!CONSP (prop) || XFASTINT (Flength (prop)) < 2)
Fsignal (Qerror, list2 (build_string ("Illegal hash table test"), Fsignal (Qerror, list2 (build_string ("Invalid hash table test"),
test)); test));
user_test = Fnth (make_number (0), prop); user_test = Fnth (make_number (0), prop);
user_hash = Fnth (make_number (1), prop); user_hash = Fnth (make_number (1), prop);
...@@ -4680,9 +4683,9 @@ to `key-and-value'. Default value of WEAK is nil.") ...@@ -4680,9 +4683,9 @@ to `key-and-value'. Default value of WEAK is nil.")
/* See if there's a `:size SIZE' argument. */ /* See if there's a `:size SIZE' argument. */
i = get_key_arg (QCsize, nargs, args, used); i = get_key_arg (QCsize, nargs, args, used);
size = i < 0 ? make_number (DEFAULT_HASH_SIZE) : args[i]; size = i < 0 ? make_number (DEFAULT_HASH_SIZE) : args[i];
if (!INTEGERP (size) || XINT (size) <= 0) if (!INTEGERP (size) || XINT (size) < 0)
Fsignal (Qerror, Fsignal (Qerror,
list2 (build_string ("Illegal hash table size"), list2 (build_string ("Invalid hash table size"),
size)); size));
/* Look for `:rehash-size SIZE'. */ /* Look for `:rehash-size SIZE'. */
...@@ -4692,7 +4695,7 @@ to `key-and-value'. Default value of WEAK is nil.") ...@@ -4692,7 +4695,7 @@ to `key-and-value'. Default value of WEAK is nil.")
|| (INTEGERP (rehash_size) && XINT (rehash_size) <= 0) || (INTEGERP (rehash_size) && XINT (rehash_size) <= 0)
|| XFLOATINT (rehash_size) <= 1.0) || XFLOATINT (rehash_size) <= 1.0)
Fsignal (Qerror, Fsignal (Qerror,
list2 (build_string ("Illegal hash table rehash size"), list2 (build_string ("Invalid hash table rehash size"),
rehash_size)); rehash_size));
/* Look for `:rehash-threshold THRESHOLD'. */ /* Look for `:rehash-threshold THRESHOLD'. */
...@@ -4702,7 +4705,7 @@ to `key-and-value'. Default value of WEAK is nil.") ...@@ -4702,7 +4705,7 @@ to `key-and-value'. Default value of WEAK is nil.")
|| XFLOATINT (rehash_threshold) <= 0.0 || XFLOATINT (rehash_threshold) <= 0.0
|| XFLOATINT (rehash_threshold) > 1.0) || XFLOATINT (rehash_threshold) > 1.0)
Fsignal (Qerror, Fsignal (Qerror,
list2 (build_string ("Illegal hash table rehash threshold"), list2 (build_string ("Invalid hash table rehash threshold"),
rehash_threshold)); rehash_threshold));
/* Look for `:weakness WEAK'. */ /* Look for `:weakness WEAK'. */
...@@ -4715,7 +4718,7 @@ to `key-and-value'. Default value of WEAK is nil.") ...@@ -4715,7 +4718,7 @@ to `key-and-value'. Default value of WEAK is nil.")
&& !EQ (weak, Qvalue) && !EQ (weak, Qvalue)
&& !EQ (weak, Qkey_or_value) && !EQ (weak, Qkey_or_value)
&& !EQ (weak, Qkey_and_value)) && !EQ (weak, Qkey_and_value))
Fsignal (Qerror, list2 (build_string ("Illegal hash table weakness"), Fsignal (Qerror, list2 (build_string ("Invalid hash table weakness"),
weak)); weak));
/* Now, all args should have been used up, or there's a problem. */ /* Now, all args should have been used up, or there's a problem. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment