comparison th_string.c @ 715:6f627f4f11db

Fix th_strncasecmp() edge case.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Apr 2020 18:38:23 +0300
parents ec6a3790a91b
children 4ca6a3b30fe8
comparison
equal deleted inserted replaced
714:ec6a3790a91b 715:6f627f4f11db
509 s1++; 509 s1++;
510 s2++; 510 s2++;
511 n--; 511 n--;
512 } 512 }
513 513
514 return th_tolower(*s1) - th_tolower(*s2); 514 return (n == 0) ? 0 : th_tolower(*s1) - th_tolower(*s2);
515 } 515 }
516 516
517 517
518 /* Check if end of the given string str matches needle 518 /* Check if end of the given string str matches needle
519 * case-insensitively, return pointer to start of the match, 519 * case-insensitively, return pointer to start of the match,