diff options
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; } |