spa: use spa_assert_se() for bugs in the util string functions

These are programming bugs that should never happen, so let's always
abort.
This commit is contained in:
Peter Hutterer 2021-07-27 10:07:10 +10:00
parent 40f1d2b881
commit 63d833dabf

View file

@ -73,7 +73,7 @@ static inline bool spa_strstartswith(const char *s, const char *prefix)
if (SPA_UNLIKELY(s == NULL))
return false;
spa_assert(prefix);
spa_assert_se(prefix);
return strncmp(s, prefix, strlen(prefix)) == 0;
}
@ -91,7 +91,7 @@ static inline bool spa_strendswith(const char *s, const char *suffix)
if (SPA_UNLIKELY(s == NULL))
return false;
spa_assert(suffix);
spa_assert_se(suffix);
l1 = strlen(s);
l2 = strlen(suffix);
@ -228,7 +228,7 @@ static inline int spa_vscnprintf(char *buffer, size_t size, const char *format,
{
int r;
spa_assert((ssize_t)size > 0);
spa_assert_se((ssize_t)size > 0);
r = vsnprintf(buffer, size, format, args);
if (SPA_UNLIKELY(r < 0))