aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/src/fns.c b/src/fns.c
index 06d4e358f10..7a8ddc04540 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -91,6 +91,12 @@ enum { QUIT_COUNT_HEURISTIC = 1 << 16 };
91 91
92/* Random data-structure functions. */ 92/* Random data-structure functions. */
93 93
94static void
95CHECK_LIST_END (Lisp_Object x, Lisp_Object y)
96{
97 CHECK_TYPE (NILP (x), Qlistp, y);
98}
99
94DEFUN ("length", Flength, Slength, 1, 1, 0, 100DEFUN ("length", Flength, Slength, 1, 1, 0,
95 doc: /* Return the length of vector, list or string SEQUENCE. 101 doc: /* Return the length of vector, list or string SEQUENCE.
96A byte-code function object is also allowed. 102A byte-code function object is also allowed.
@@ -445,7 +451,7 @@ with the original. */)
445 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg)) 451 if (!CONSP (arg) && !VECTORP (arg) && !STRINGP (arg))
446 wrong_type_argument (Qsequencep, arg); 452 wrong_type_argument (Qsequencep, arg);
447 453
448 return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0); 454 return concat (1, &arg, XTYPE (arg), 0);
449} 455}
450 456
451/* This structure holds information of an argument of `concat' that is 457/* This structure holds information of an argument of `concat' that is
@@ -3337,7 +3343,8 @@ static struct Lisp_Hash_Table *weak_hash_tables;
3337 3343
3338/* Various symbols. */ 3344/* Various symbols. */
3339 3345
3340static Lisp_Object Qhash_table_p, Qkey, Qvalue, Qeql; 3346static Lisp_Object Qhash_table_p;
3347static Lisp_Object Qkey, Qvalue, Qeql;
3341Lisp_Object Qeq, Qequal; 3348Lisp_Object Qeq, Qequal;
3342Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness; 3349Lisp_Object QCtest, QCsize, QCrehash_size, QCrehash_threshold, QCweakness;
3343static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; 3350static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
@@ -3347,6 +3354,48 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
3347 Utilities 3354 Utilities
3348 ***********************************************************************/ 3355 ***********************************************************************/
3349 3356
3357static void
3358CHECK_HASH_TABLE (Lisp_Object x)
3359{
3360 CHECK_TYPE (HASH_TABLE_P (x), Qhash_table_p, x);
3361}
3362
3363static void
3364set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value)
3365{
3366 h->key_and_value = key_and_value;
3367}
3368static void
3369set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next)
3370{
3371 h->next = next;
3372}
3373static void
3374set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
3375{
3376 gc_aset (h->next, idx, val);
3377}
3378static void
3379set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash)
3380{
3381 h->hash = hash;
3382}
3383static void
3384set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
3385{
3386 gc_aset (h->hash, idx, val);
3387}
3388static void
3389set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index)
3390{
3391 h->index = index;
3392}
3393static void
3394set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
3395{
3396 gc_aset (h->index, idx, val);
3397}
3398
3350/* If OBJ is a Lisp hash table, return a pointer to its struct 3399/* If OBJ is a Lisp hash table, return a pointer to its struct
3351 Lisp_Hash_Table. Otherwise, signal an error. */ 3400 Lisp_Hash_Table. Otherwise, signal an error. */
3352 3401