25 #ifndef PIPEWIRE_UTILS_H
26 #define PIPEWIRE_UTILS_H
51 pw_split_walk(
const char *str,
const char *delimiter,
size_t *len,
const char **state);
54 pw_split_strv(
const char *str,
const char *delimiter,
int max_tokens,
int *n_tokens);
60 pw_strip(
char *str,
const char *whitespace);
62 #if !defined(strndupa)
63 # define strndupa(s, n) \
65 const char *__old = (s); \
66 size_t __len = strnlen(__old, (n)); \
67 char *__new = (char *) __builtin_alloca(__len + 1); \
68 memcpy(__new, __old, __len); \
69 __new[__len] = '\0'; \
77 const char *__old = (s); \
78 size_t __len = strlen(__old) + 1; \
79 char *__new = (char *) alloca(__len); \
80 (char *) memcpy(__new, __old, __len); \
void(* pw_destroy_t)(void *object)
a function to destroy an item
Definition: src/pipewire/utils.h:48
char * pw_strip(char *str, const char *whitespace)
Strip all whitespace before and after a string.
Definition: utils.c:120
void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:99
const char * pw_split_walk(const char *str, const char *delimiter, size_t *len, const char **state)
Split a string based on delimiters.
Definition: utils.c:43
char ** pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tokens)
Split a string based on delimiters.
Definition: utils.c:67