include/strutils: remove unnecessary cast

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-07-20 12:52:09 +02:00
parent 9854912fef
commit 8a7aeeda67
1 changed files with 2 additions and 2 deletions

View File

@ -149,12 +149,12 @@ static inline const char *endswith(const char *s, const char *postfix)
size_t pl = postfix ? strlen(postfix) : 0;
if (pl == 0)
return (char *)s + sl;
return s + sl;
if (sl < pl)
return NULL;
if (memcmp(s + sl - pl, postfix, pl) != 0)
return NULL;
return (char *)s + sl - pl;
return s + sl - pl;
}
/*