From bd58f2a2584dbc735decc6cedd6af06a21c99f9b Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 10 Nov 2019 11:12:03 +0100 Subject: [PATCH] core: make-hash-table: Fix optional argument. * src/hash.c (make_hash_table): Fix optional argument. * src/builtins.c (mes_builtins): Update arity. --- src/builtins.c | 2 +- src/hash.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/builtins.c b/src/builtins.c index 0cc9ec46..558fd1d9 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -179,7 +179,7 @@ mes_builtins (struct scm *a) /*:((internal)) */ a = init_builtin (builtin_type, "hashq-set!", 3, &hashq_set_x, a); a = init_builtin (builtin_type, "hash-set!", 3, &hash_set_x, a); a = init_builtin (builtin_type, "hash-table-printer", 1, &hash_table_printer, a); - a = init_builtin (builtin_type, "make-hash-table", 1, &make_hash_table, a); + a = init_builtin (builtin_type, "make-hash-table", -1, &make_hash_table, a); /* src/lib.c */ a = init_builtin (builtin_type, "core:type", 1, &type_, a); a = init_builtin (builtin_type, "core:car", 1, &car_, a); diff --git a/src/hash.c b/src/hash.c index ed1bb5d2..3aa41368 100644 --- a/src/hash.c +++ b/src/hash.c @@ -205,11 +205,12 @@ make_hash_table_ (long size) } struct scm * -make_hash_table (struct scm *x) +make_hash_table (struct scm *x) /*:((arity . n)) */ { long size = 0; if (x->type == TPAIR) { + x = x->car; assert_msg (x->type == TNUMBER, "x->type == TNUMBER"); size = x->value; }