* Ensure that ends_with() actually tests against the end of the string.
This commit is contained in:
parent
029928569a
commit
37704b8b8b
4
utils.c
4
utils.c
@ -29,8 +29,8 @@
|
||||
int
|
||||
ends_with(const char * haystack, const char * needle)
|
||||
{
|
||||
const char *found = strcasestr(haystack, needle);
|
||||
return (found && found[strlen(needle)] == '\0');
|
||||
const char * end = strrchr(haystack, *needle);
|
||||
return (strcasecmp(end?end:"", needle) ? 0 : 1);
|
||||
}
|
||||
|
||||
char *
|
||||
|
Loading…
x
Reference in New Issue
Block a user