From 9db8e3e472646af6030d3961c35e099cfa8fd952 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 13 Nov 2019 08:16:04 +0100 Subject: [PATCH] core: Allow non-string hash keys. This merely allows adding non-string keys to a hash table and puts them non-string keys in bucket 0. Efficiency is lost. TODO: calculate a proper hash. * src/hash.c (hash_): Allow non-string keys in bucket 0. --- src/hash.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hash.c b/src/hash.c index 6fe262bd..68f0cd1a 100644 --- a/src/hash.c +++ b/src/hash.c @@ -46,13 +46,9 @@ hashq_ (struct scm *x, long size) int hash_ (struct scm *x, long size) { - if (x->type != TSTRING) - { - eputs ("hash_ failed, not a string:"); - display_error_ (x); - assert_msg (0, "0"); - } - return hash_cstring (cell_bytes (x->string), size); + if (x->type == TSTRING) + return hash_cstring (cell_bytes (x->string), size); + return 0; } struct scm *