From 3ec1ed2ce0198ccef4bf4553f6a21cfeab5ba7d6 Mon Sep 17 00:00:00 2001 From: Marius Gerbershagen Date: Sun, 7 Mar 2021 19:20:04 +0100 Subject: [PATCH] interpreter: simplify handling of :allow-other-keys parsing a bit Get rid of the unnecessary mask (which wouldn't have worked correctly anyway if somebody passed more than 32 :allow-other-keys arguments). --- src/c/interpreter.d | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/c/interpreter.d b/src/c/interpreter.d index 34fd2a1c0..a54b11509 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -656,20 +656,23 @@ ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes) if (flag != ECL_NIL) ECL_STACK_PUSH(the_env, value); ECL_STACK_PUSH(the_env, flag); } - if (count) { - if (Null(aok)) { - int aok = 0, mask = 1; - cl_object *p = first; - for (; p != last; ++p) { - if (*(p++) == @':allow-other-keys') { - if (!Null(*p)) aok |= mask; - mask <<= 1; + if (count && Null(aok)) { + cl_object *p = first; + for (; p != last; ++p) { + if (*(p++) == @':allow-other-keys') { + aok = *p; + count -= 2; + /* only the first :allow-other-keys argument is considered */ + for (++p; p != last; ++p) { + if (*(p++) != @':allow-other-keys') + break; count -= 2; } + break; } - if (ecl_unlikely(count && (aok & 1) == 0)) { - unknown_keyword(bytecodes, frame); - } + } + if (ecl_likely(count && Null(aok))) { + unknown_keyword(bytecodes, frame); } } THREAD_NEXT;