mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05:00
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:
parent
40f1d2b881
commit
63d833dabf
1 changed files with 3 additions and 3 deletions
|
|
@ -73,7 +73,7 @@ static inline bool spa_strstartswith(const char *s, const char *prefix)
|
||||||
if (SPA_UNLIKELY(s == NULL))
|
if (SPA_UNLIKELY(s == NULL))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
spa_assert(prefix);
|
spa_assert_se(prefix);
|
||||||
|
|
||||||
return strncmp(s, prefix, strlen(prefix)) == 0;
|
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))
|
if (SPA_UNLIKELY(s == NULL))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
spa_assert(suffix);
|
spa_assert_se(suffix);
|
||||||
|
|
||||||
l1 = strlen(s);
|
l1 = strlen(s);
|
||||||
l2 = strlen(suffix);
|
l2 = strlen(suffix);
|
||||||
|
|
@ -228,7 +228,7 @@ static inline int spa_vscnprintf(char *buffer, size_t size, const char *format,
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
spa_assert((ssize_t)size > 0);
|
spa_assert_se((ssize_t)size > 0);
|
||||||
|
|
||||||
r = vsnprintf(buffer, size, format, args);
|
r = vsnprintf(buffer, size, format, args);
|
||||||
if (SPA_UNLIKELY(r < 0))
|
if (SPA_UNLIKELY(r < 0))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue