aboutsummaryrefslogtreecommitdiffstats
path: root/memrcaseeqlen.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-06-11 16:37:09 +0200
committerMattias Andrée <maandree@kth.se>2022-06-11 16:37:09 +0200
commitfcfe59c1f2219408ac2a9cd84b386816ff252221 (patch)
tree0f46c009babfba2d0200ece3ecce067c548a66b6 /memrcaseeqlen.c
parentRemove `static` from some `static inline` (diff)
downloadlibsimple-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.c10
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;
}