0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

bstr: short-circuit bstr_equals()

This commit is contained in:
wm4 2017-07-02 12:43:18 +02:00
parent d39f3bcd3a
commit 66478cff14

View File

@ -189,12 +189,12 @@ static inline int bstrcmp0(struct bstr str1, const char *str2)
static inline bool bstr_equals(struct bstr str1, struct bstr str2)
{
return bstrcmp(str1, str2) == 0;
return str1.len == str2.len && bstrcmp(str1, str2) == 0;
}
static inline bool bstr_equals0(struct bstr str1, const char *str2)
{
return bstrcmp(str1, bstr0(str2)) == 0;
return bstr_equals(str1, bstr0(str2));
}
static inline int bstrcasecmp0(struct bstr str1, const char *str2)