mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
spa: add spa_strstartswith
This commit is contained in:
parent
0346c616e2
commit
606108f409
1 changed files with 16 additions and 0 deletions
|
|
@ -63,6 +63,22 @@ static inline bool spa_strneq(const char *s1, const char *s2, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \return true if \a s starts with the \a prefix or false otherwise.
|
||||||
|
* A \a s is NULL, it never starts with the given \a prefix. A \a prefix of
|
||||||
|
* NULL is a bug in the caller.
|
||||||
|
*/
|
||||||
|
static inline bool spa_strstartswith(const char *s, const char *prefix)
|
||||||
|
{
|
||||||
|
if (SPA_UNLIKELY(s == NULL))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
spa_assert(prefix);
|
||||||
|
|
||||||
|
return strncmp(s, prefix, strlen(prefix)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \return true if \a s ends with the \a suffix or false otherwise.
|
* \return true if \a s ends with the \a suffix or false otherwise.
|
||||||
* A \a s is NULL, it never ends with the given \a suffix. A \a suffix of
|
* A \a s is NULL, it never ends with the given \a suffix. A \a suffix of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue