aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-03-10 17:25:29 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-03-10 17:25:29 +0200
commit776224c34ed894e63e3bcf7806c58090d2b72f4f (patch)
tree4dc7a237e9ef649e590570150a036419165d7989 /lib
parentc3d40a0dba2d4cff85ef78d06973aeacc778cc74 (diff)
Fix bugs in u8haspfx() and u8hassfx()
Diffstat (limited to 'lib')
-rw-r--r--lib/mbstring/u8haspfx.c3
-rw-r--r--lib/mbstring/u8hassfx.c3
2 files changed, 4 insertions, 2 deletions
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 <string.h>
+#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 <string.h>
+#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);
}