diff options
Diffstat (limited to 'lib/mbstring')
-rw-r--r-- | lib/mbstring/u8haspfx.c | 9 | ||||
-rw-r--r-- | lib/mbstring/u8hassfx.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/mbstring/u8haspfx.c b/lib/mbstring/u8haspfx.c new file mode 100644 index 0000000..9b5ae66 --- /dev/null +++ b/lib/mbstring/u8haspfx.c @@ -0,0 +1,9 @@ +#include <string.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); +} diff --git a/lib/mbstring/u8hassfx.c b/lib/mbstring/u8hassfx.c new file mode 100644 index 0000000..8ca5f96 --- /dev/null +++ b/lib/mbstring/u8hassfx.c @@ -0,0 +1,9 @@ +#include <string.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); +} |