diff options
author | Mattias Andrée <maandree@kth.se> | 2022-06-11 16:37:09 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-06-11 16:37:09 +0200 |
commit | fcfe59c1f2219408ac2a9cd84b386816ff252221 (patch) | |
tree | 0f46c009babfba2d0200ece3ecce067c548a66b6 /memrcaseeqlen.c | |
parent | Remove `static` from some `static inline` (diff) | |
download | libsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.gz libsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.bz2 libsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.xz |
Fix warnings, replace some static inline with inline + extern inline, and fix glibc support
Diffstat (limited to 'memrcaseeqlen.c')
-rw-r--r-- | memrcaseeqlen.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/memrcaseeqlen.c b/memrcaseeqlen.c index 3f586b7..91b98d3 100644 --- a/memrcaseeqlen.c +++ b/memrcaseeqlen.c @@ -6,9 +6,15 @@ size_t libsimple_memrcaseeqlen(const void *a_, size_t n, const void *b_, size_t m) { - const char *a = &((char *)a_)[n], *b = &((char *)b_)[m]; + const char *a = &((const char *)a_)[n]; + const char *b = &((const char *)b_)[m]; size_t i = 0, len = n < m ? n : m; - for (; i < len && (--a, --b, tolower(*a) == tolower(*b)); i++); + for (; i < len; i++) { + a--; + b--; + if (tolower(*a) != tolower(*b)) + break; + } return i; } |