From 049164b3f4f7d9ca4eaa59db41155c0a9936e0d3 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Thu, 28 Apr 2016 14:54:48 +0200 Subject: Move string compare helper to other string functions. --- source/fitz/string.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/fitz/string.c') diff --git a/source/fitz/string.c b/source/fitz/string.c index 025b612c..95b216fe 100644 --- a/source/fitz/string.c +++ b/source/fitz/string.c @@ -1,5 +1,25 @@ #include "mupdf/fitz.h" +static inline int +fz_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + return c + 32; + return c; +} + +int +fz_strcasecmp(const char *a, const char *b) +{ + while (fz_tolower(*a) == fz_tolower(*b)) + { + if (*a++ == 0) + return 0; + b++; + } + return fz_tolower(*a) - fz_tolower(*b); +} + char * fz_strsep(char **stringp, const char *delim) { -- cgit v1.2.3