Go to the documentation of this file.
25 #ifndef PIPEWIRE_UTILS_H
26 #define PIPEWIRE_UTILS_H
34 #ifndef _POSIX_C_SOURCE
35 # include <sys/mount.h>
55 pw_split_walk(
const char *str,
const char *delimiter,
size_t *len,
const char **state);
58 pw_split_strv(
const char *str,
const char *delimiter,
int max_tokens,
int *n_tokens);
64 pw_strip(
char *str,
const char *whitespace);
66 #if !defined(strndupa)
67 # define strndupa(s, n) \
69 const char *__old = (s); \
70 size_t __len = strnlen(__old, (n)); \
71 char *__new = (char *) __builtin_alloca(__len + 1); \
72 memcpy(__new, __old, __len); \
73 __new[__len] = '\0'; \
81 const char *__old = (s); \
82 size_t __len = strlen(__old) + 1; \
83 char *__new = (char *) alloca(__len); \
84 (char *) memcpy(__new, __old, __len); \
char * pw_strip(char *str, const char *whitespace)
Strip all whitespace before and after a string.
Definition: utils.c:119
#define SPA_EXPORT
Definition: defs.h:208
#define pw_array_add_ptr(a, p)
Add a pointer to array.
Definition: array.h:164
void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:98
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:66
void(* pw_destroy_t)(void *object)
a function to destroy an item
Definition: src/pipewire/utils.h:52
void * data
pointer to array data
Definition: array.h:49