From de0f086dab764990416d2a995306c323c39e45af Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 24 Oct 2019 21:43:29 +0200 Subject: [PATCH] core: string_equal_p: Prepare for M2-Planet. * src/string.c (string_equal_p): Prepare for M2-Planet. --- src/string.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/string.c b/src/string.c index 44fabab8..3c76a1a1 100644 --- a/src/string.c +++ b/src/string.c @@ -79,11 +79,15 @@ string_equal_p (SCM a, SCM b) /*:((name . "string=?")) */ eputs ("\n"); assert_msg ((TYPE (a) == TSTRING && TYPE (b) == TSTRING) || (TYPE (a) == TKEYWORD || TYPE (b) == TKEYWORD), "(TYPE (a) == TSTRING && TYPE (b) == TSTRING) || (TYPE (a) == TKEYWORD || TYPE (b) == TKEYWORD)"); } - if (a == b - || STRING (a) == STRING (b) - || (LENGTH (a) == 0 && LENGTH (b) == 0) - || (LENGTH (a) == LENGTH (b) && !memcmp (cell_bytes (STRING (a)), cell_bytes (STRING (b)), LENGTH (a)))) + if (a == b) return cell_t; + if (STRING (a) == STRING (b)) + return cell_t; + if (LENGTH (a) == 0 && LENGTH (b) == 0) + return cell_t; + if (LENGTH (a) == LENGTH (b)) + if (memcmp (cell_bytes (STRING (a)), cell_bytes (STRING (b)), LENGTH (a)) == 0) + return cell_t; return cell_f; }