mirror of
https://github.com/albfan/miraclecast.git
synced 2025-02-12 14:41:57 +00:00
shl: update shl dlist/util
Two new helpers to verify empty strings and list-link-state. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
parent
bc69f5b27b
commit
4f740dfffb
2 changed files with 10 additions and 0 deletions
|
@ -81,6 +81,11 @@ static inline void shl_dlist_unlink(struct shl_dlist *e)
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool shl_dlist_linked(struct shl_dlist *e)
|
||||
{
|
||||
return e->next && e->prev;
|
||||
}
|
||||
|
||||
static inline bool shl_dlist_empty(struct shl_dlist *head)
|
||||
{
|
||||
return head->next == head;
|
||||
|
|
|
@ -96,6 +96,11 @@ _shl_sentinel_ char *shl_strjoin(const char *first, ...);
|
|||
int shl_strsplit_n(const char *str, size_t len, const char *sep, char ***out);
|
||||
int shl_strsplit(const char *str, const char *sep, char ***out);
|
||||
|
||||
static inline bool shl_isempty(const char *str)
|
||||
{
|
||||
return !str || !*str;
|
||||
}
|
||||
|
||||
static inline char *shl_startswith(const char *str, const char *prefix)
|
||||
{
|
||||
if (!strncmp(str, prefix, strlen(prefix)))
|
||||
|
|
Loading…
Reference in a new issue