Go to the documentation of this file.
25 #ifndef PIPEWIRE_UTILS_H
26 #define PIPEWIRE_UTILS_H
34 #include <spa/utils/defs.h>
35 #include <spa/pod/pod.h>
46 pw_split_walk(
const char *str,
const char *delimiter,
size_t *len,
const char **state);
49 pw_split_strv(
const char *str,
const char *delimiter,
int max_tokens,
int *n_tokens);
55 pw_strip(
char *str,
const char *whitespace);
57 #if !defined(strndupa)
58 # define strndupa(s, n) \
60 const char *__old = (s); \
61 size_t __len = strnlen(__old, (n)); \
62 char *__new = (char *) __builtin_alloca(__len + 1); \
63 memcpy(__new, __old, __len); \
64 __new[__len] = '\0'; \
const SPA_EXPORT 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:45
SPA_EXPORT 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:71
An array object.
Definition: array.h:43
#define pw_array_add_ptr(a, p)
Add a pointer to array.
Definition: array.h:158
SPA_EXPORT char * pw_strip(char *str, const char *whitespace)
Strip all whitespace before and after a string.
Definition: utils.c:124
void(* pw_destroy_t)(void *object)
a function to destroy an item
Definition: utils.h:43
void * data
pointer to array data
Definition: array.h:44
SPA_EXPORT void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:105
static void pw_array_init(struct pw_array *arr, size_t extend)
Initialize the array with given extend.
Definition: array.h:85