From 776224c34ed894e63e3bcf7806c58090d2b72f4f Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 10 Mar 2024 17:25:29 +0200 Subject: Fix bugs in u8haspfx() and u8hassfx() --- lib/mbstring/u8haspfx.c | 3 ++- lib/mbstring/u8hassfx.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/mbstring/u8haspfx.c b/lib/mbstring/u8haspfx.c index 9b5ae66..b6cea50 100644 --- a/lib/mbstring/u8haspfx.c +++ b/lib/mbstring/u8haspfx.c @@ -1,9 +1,10 @@ #include +#include "macros.h" #include "mbstring.h" bool u8haspfx(const char8_t *s, size_t n, const char8_t *pfx, size_t m) { - return n >= m && memcmp(s, pfx, m); + return n >= m && memeq(s, pfx, m); } diff --git a/lib/mbstring/u8hassfx.c b/lib/mbstring/u8hassfx.c index 8ca5f96..e31bb4b 100644 --- a/lib/mbstring/u8hassfx.c +++ b/lib/mbstring/u8hassfx.c @@ -1,9 +1,10 @@ #include +#include "macros.h" #include "mbstring.h" bool u8hassfx(const char8_t *s, size_t n, const char8_t *sfx, size_t m) { - return n >= m && memcmp(s + n - m, sfx, m); + return n >= m && memeq(s + n - m, sfx, m); } -- cgit v1.2.3