diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-05-21 11:09:17 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-06-02 02:08:17 +0200 |
commit | 928b43eab613970ebe6448b294bba866d43d12bd (patch) | |
tree | 45febe0455ee90abeb1398c62e7e68c85e050209 /source/fitz/string.c | |
parent | 4d473e7f6a6ec72265270c03a26b48e27db11282 (diff) | |
download | mupdf-928b43eab613970ebe6448b294bba866d43d12bd.tar.xz |
Add a fz_strnlen function (strnlen is not standard C).
Diffstat (limited to 'source/fitz/string.c')
-rw-r--r-- | source/fitz/string.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/fitz/string.c b/source/fitz/string.c index dbcc2c22..a014ce89 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -14,6 +14,13 @@ fz_tolower(int c) return c; } +size_t +fz_strnlen(const char *s, size_t n) +{ + const char *p = memchr(s, 0, n); + return p ? p - s : n; +} + int fz_strcasecmp(const char *a, const char *b) { |