aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorStefan Monnier2002-07-07 20:57:25 +0000
committerStefan Monnier2002-07-07 20:57:25 +0000
commitcf42cb72f28d4451f0338971c6239068fb275aab (patch)
tree10206b4050fb63ce05d24087b36dd4e9c9d23f7b /src/fns.c
parent141788b50c5c2d01ef3607885224d474be6bd138 (diff)
downloademacs-cf42cb72f28d4451f0338971c6239068fb275aab.tar.gz
emacs-cf42cb72f28d4451f0338971c6239068fb275aab.zip
(Fnconc): Use XCDR.
(Fprovide): Use CONSP and XCDR. (HASH_KEY, HASH_VALUE, HASH_NEXT, HASH_HASH, HASH_INDEX) (HASH_TABLE_SIZE): Delete: moved to lisp.h. (Fmake_hash_table): Accept `:size nil'. (Fmakehash): Delete: moved to subr.el. (syms_of_fns): Don't defsubr makehash.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c55
1 files changed, 7 insertions, 48 deletions
diff --git a/src/fns.c b/src/fns.c
index dd527ddc76b..83e7353eb98 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2742,7 +2742,7 @@ usage: (nconc &rest LISTS) */)
2742 while (CONSP (tem)) 2742 while (CONSP (tem))
2743 { 2743 {
2744 tail = tem; 2744 tail = tem;
2745 tem = Fcdr (tail); 2745 tem = XCDR (tail);
2746 QUIT; 2746 QUIT;
2747 } 2747 }
2748 2748
@@ -3206,8 +3206,8 @@ particular subfeatures supported in this version of FEATURE. */)
3206 3206
3207 /* Run any load-hooks for this file. */ 3207 /* Run any load-hooks for this file. */
3208 tem = Fassq (feature, Vafter_load_alist); 3208 tem = Fassq (feature, Vafter_load_alist);
3209 if (!NILP (tem)) 3209 if (CONSP (tem))
3210 Fprogn (Fcdr (tem)); 3210 Fprogn (XCDR (tem));
3211 3211
3212 return feature; 3212 return feature;
3213} 3213}
@@ -3896,32 +3896,6 @@ base64_decode_1 (from, to, length, multibyte, nchars_return)
3896 if a `:linear-search t' argument is given to make-hash-table. */ 3896 if a `:linear-search t' argument is given to make-hash-table. */
3897 3897
3898 3898
3899/* Value is the key part of entry IDX in hash table H. */
3900
3901#define HASH_KEY(H, IDX) AREF ((H)->key_and_value, 2 * (IDX))
3902
3903/* Value is the value part of entry IDX in hash table H. */
3904
3905#define HASH_VALUE(H, IDX) AREF ((H)->key_and_value, 2 * (IDX) + 1)
3906
3907/* Value is the index of the next entry following the one at IDX
3908 in hash table H. */
3909
3910#define HASH_NEXT(H, IDX) AREF ((H)->next, (IDX))
3911
3912/* Value is the hash code computed for entry IDX in hash table H. */
3913
3914#define HASH_HASH(H, IDX) AREF ((H)->hash, (IDX))
3915
3916/* Value is the index of the element in hash table H that is the
3917 start of the collision list at index IDX in the index vector of H. */
3918
3919#define HASH_INDEX(H, IDX) AREF ((H)->index, (IDX))
3920
3921/* Value is the size of hash table H. */
3922
3923#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
3924
3925/* The list of all weak hash tables. Don't staticpro this one. */ 3899/* The list of all weak hash tables. Don't staticpro this one. */
3926 3900
3927Lisp_Object Vweak_hash_tables; 3901Lisp_Object Vweak_hash_tables;
@@ -4929,8 +4903,10 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4929 4903
4930 /* See if there's a `:size SIZE' argument. */ 4904 /* See if there's a `:size SIZE' argument. */
4931 i = get_key_arg (QCsize, nargs, args, used); 4905 i = get_key_arg (QCsize, nargs, args, used);
4932 size = i < 0 ? make_number (DEFAULT_HASH_SIZE) : args[i]; 4906 size = i < 0 ? Qnil : args[i];
4933 if (!INTEGERP (size) || XINT (size) < 0) 4907 if (NILP (size))
4908 size = make_number (DEFAULT_HASH_SIZE);
4909 else if (!INTEGERP (size) || XINT (size) < 0)
4934 Fsignal (Qerror, 4910 Fsignal (Qerror,
4935 list2 (build_string ("Invalid hash table size"), 4911 list2 (build_string ("Invalid hash table size"),
4936 size)); 4912 size));
@@ -4988,22 +4964,6 @@ DEFUN ("copy-hash-table", Fcopy_hash_table, Scopy_hash_table, 1, 1, 0,
4988} 4964}
4989 4965
4990 4966
4991DEFUN ("makehash", Fmakehash, Smakehash, 0, 1, 0,
4992 doc: /* Create a new hash table.
4993
4994Optional first argument TEST specifies how to compare keys in the
4995table. Predefined tests are `eq', `eql', and `equal'. Default is
4996`eql'. New tests can be defined with `define-hash-table-test'. */)
4997 (test)
4998 Lisp_Object test;
4999{
5000 Lisp_Object args[2];
5001 args[0] = QCtest;
5002 args[1] = NILP (test) ? Qeql : test;
5003 return Fmake_hash_table (2, args);
5004}
5005
5006
5007DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0, 4967DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0,
5008 doc: /* Return the number of elements in TABLE. */) 4968 doc: /* Return the number of elements in TABLE. */)
5009 (table) 4969 (table)
@@ -5427,7 +5387,6 @@ syms_of_fns ()
5427 defsubr (&Ssxhash); 5387 defsubr (&Ssxhash);
5428 defsubr (&Smake_hash_table); 5388 defsubr (&Smake_hash_table);
5429 defsubr (&Scopy_hash_table); 5389 defsubr (&Scopy_hash_table);
5430 defsubr (&Smakehash);
5431 defsubr (&Shash_table_count); 5390 defsubr (&Shash_table_count);
5432 defsubr (&Shash_table_rehash_size); 5391 defsubr (&Shash_table_rehash_size);
5433 defsubr (&Shash_table_rehash_threshold); 5392 defsubr (&Shash_table_rehash_threshold);