aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2024-11-17 07:33:47 -0800
committerGitHub <noreply@github.com>2024-11-17 07:33:47 -0800
commitbafa6bfff01a03e7e25cd476ae6396e88622358b (patch)
tree4dfd099f28e9ca267bd8b329f68dc58474a703d2
parentMerge pull request #1518 from pyrmont/bugfix.s390x-workflow (diff)
parentfix janet_string_equalconst (diff)
Merge pull request #1519 from ianthehenry/fix-string-equal-with-byteview
fix janet_string_equalconst
-rw-r--r--src/core/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 277b1a25..6a67482c 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -71,10 +71,10 @@ int janet_string_compare(const uint8_t *lhs, const uint8_t *rhs) {
int janet_string_equalconst(const uint8_t *lhs, const uint8_t *rhs, int32_t rlen, int32_t rhash) {
int32_t lhash = janet_string_hash(lhs);
int32_t llen = janet_string_length(lhs);
- if (lhs == rhs)
- return 1;
if (lhash != rhash || llen != rlen)
return 0;
+ if (lhs == rhs)
+ return 1;
return !memcmp(lhs, rhs, rlen);
}