1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-12 15:11:56 +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:
David Herrmann 2014-03-19 12:36:49 +01:00
parent bc69f5b27b
commit 4f740dfffb
2 changed files with 10 additions and 0 deletions

View file

@ -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) static inline bool shl_dlist_empty(struct shl_dlist *head)
{ {
return head->next == head; return head->next == head;

View file

@ -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_n(const char *str, size_t len, const char *sep, char ***out);
int shl_strsplit(const char *str, 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) static inline char *shl_startswith(const char *str, const char *prefix)
{ {
if (!strncmp(str, prefix, strlen(prefix))) if (!strncmp(str, prefix, strlen(prefix)))