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
commitf685f45898ff279cdf38a4c838534ea3fbaacd6e (patch)
treef8cc3360b6ec9cb8ee227579a15132a333ac2bf4
parentc60a0234506745fb309cf512840bf81e5b15c684 (diff)
downloadtxr-f685f45898ff279cdf38a4c838534ea3fbaacd6e.tar.gz
txr-f685f45898ff279cdf38a4c838534ea3fbaacd6e.tar.bz2
txr-f685f45898ff279cdf38a4c838534ea3fbaacd6e.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,