* 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
|
int
|
||||||
ends_with(const char * haystack, const char * needle)
|
ends_with(const char * haystack, const char * needle)
|
||||||
{
|
{
|
||||||
const char *found = strcasestr(haystack, needle);
|
const char * end = strrchr(haystack, *needle);
|
||||||
return (found && found[strlen(needle)] == '\0');
|
return (strcasecmp(end?end:"", needle) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user