summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-07 20:16:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-07 20:16:03 -0700
commit7cf66ee31d57cb31f784c4e5983828ae01dfc4d2 (patch)
treef8cc3360b6ec9cb8ee227579a15132a333ac2bf4
parent57f7ed87b589c471009726089a574890bb018571 (diff)
downloadtxr-7cf66ee31d57cb31f784c4e5983828ae01dfc4d2.tar.gz
txr-7cf66ee31d57cb31f784c4e5983828ae01dfc4d2.tar.bz2
txr-7cf66ee31d57cb31f784c4e5983828ae01dfc4d2.zip
case macros: bugfix: use hash for caseql and casequal too.
* eval.c (me_case): Correct the condition. We want to generate for all the case comparison types. The only situation we want to avoid is when the keys do not use eq equality, but caseq is used. The reason is that the underlying hash table is eql-based, not eq-based: it's not the right kind of hash table for caseql/caseql*. We can only use it if two keys might be eql that are not eq.
-rw-r--r--eval.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 072e38b6..72a5f973 100644
--- a/eval.c
+++ b/eval.c
@@ -3900,8 +3900,7 @@ static val me_case(val form, val menv)
eval_error(form_orig, lit("~s: improper form terminated by ~s"), casesym, form, nao);
if (!compat && gt(hash_count(hash), num_fast(10)) &&
- ((casesym == caseq_s || casesym == caseq_star_s) &&
- all_keys_eq))
+ ((casesym != caseq_s && casesym != caseq_star_s) || all_keys_eq))
{
return list(let_star_s, list(list(tformsym, testform, nao),
list(idxsym,