From 63d833dabf6f3d4b40c37764ac9ed138d9736ba5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 27 Jul 2021 10:07:10 +1000 Subject: [PATCH] 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. --- spa/include/spa/utils/string.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spa/include/spa/utils/string.h b/spa/include/spa/utils/string.h index 01597f78a..11a222292 100644 --- a/spa/include/spa/utils/string.h +++ b/spa/include/spa/utils/string.h @@ -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))