25 #ifndef PIPEWIRE_UTILS_H 
   26 #define PIPEWIRE_UTILS_H 
   35 #ifndef _POSIX_C_SOURCE 
   36 # include <sys/mount.h> 
   56 pw_split_walk(
const char *str, 
const char *delimiter, 
size_t *len, 
const char **state);
 
   59 pw_split_strv(
const char *str, 
const char *delimiter, 
int max_tokens, 
int *n_tokens);
 
   65 pw_strip(
char *str, 
const char *whitespace);
 
   67 #if !defined(strndupa) 
   68 # define strndupa(s, n)                                                               \ 
   70                 const char *__old = (s);                                              \ 
   71                 size_t __len = strnlen(__old, (n));                                   \ 
   72                 char *__new = (char *) __builtin_alloca(__len + 1);                   \ 
   73                 memcpy(__new, __old, __len);                                          \ 
   74                 __new[__len] = '\0';                                                  \ 
   82                 const char *__old = (s);                                              \ 
   83                 size_t __len = strlen(__old) + 1;                                     \ 
   84                 char *__new = (char *) alloca(__len);                                 \ 
   85                 (char *) memcpy(__new, __old, __len);                                 \ 
   90 ssize_t 
pw_getrandom(
void *buf, 
size_t buflen, 
unsigned int flags);
 
void * pw_reallocarray(void *ptr, size_t nmemb, size_t size)
Definition: utils.c:176
 
void(* pw_destroy_t)(void *object)
a function to destroy an item
Definition: utils.h:57
 
char * pw_strip(char *str, const char *whitespace)
Strip all whitespace before and after a string.
Definition: utils.c:127
 
void pw_free_strv(char **str)
Free a NULL terminated array of strings.
Definition: utils.c:106
 
SPA_WARN_UNUSED_RESULT ssize_t pw_getrandom(void *buf, size_t buflen, unsigned int flags)
Fill a buffer with random data.
Definition: utils.c:154
 
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:51
 
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:74
 
#define SPA_WARN_UNUSED_RESULT
Definition: defs.h:305