From 9c099977a0eb536074cad7fe0784e86621be760d Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 16 Jul 2020 21:25:06 +0200 Subject: [PATCH] core: last_pair: Prepare for M2-Planet. * src/lib.c (last_pair): Prepare for M2-Planet. --- src/lib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.c b/src/lib.c index dbd86606..3100a68f 100644 --- a/src/lib.c +++ b/src/lib.c @@ -204,8 +204,12 @@ equal2: SCM last_pair (SCM x) { - while (x != cell_nil && CDR (x) != cell_nil) - x = CDR (x); + while (x != cell_nil) + { + if (CDR (x) == cell_nil) + return x; + x = CDR (x); + } return x; }