PipeWire
0.2.0
|
Various utility functions. More...
Public Types | |
typedef void(* | pw_destroy_t) (void *object) |
a function to destroy an item More... | |
Public Member Functions | |
static struct spa_pod * | pw_spa_pod_copy (const struct spa_pod *pod) |
Copy a pod structure. More... | |
const char * | pw_split_walk (const char *str, const char *delimiter, size_t *len, const char **state) |
Split a string based on delimiters. More... | |
char ** | pw_split_strv (const char *str, const char *delimiter, int max_tokens, int *n_tokens) |
Split a string based on delimiters. More... | |
void | pw_free_strv (char **str) |
Free a NULL terminated array of strings. More... | |
char * | pw_strip (char *str, const char *whitespace) |
Strip all whitespace before and after a string. More... | |
Various utility functions.
typedef void(* pw_destroy_t) (void *object) |
a function to destroy an item
void pw_free_strv | ( | char ** | str | ) |
Free a NULL terminated array of strings.
str | a NULL terminated array of string |
Free all the strings in the array and the array
Referenced by pw_command::pw_command_free().
|
inline |
Copy a pod structure.
Referenced by pw_control_new(), and pw_link_info_update().
char ** pw_split_strv | ( | const char * | str, |
const char * | delimiter, | ||
int | max_tokens, | ||
int * | n_tokens | ||
) |
Split a string based on delimiters.
str | a string to split | |
delimiter | delimiter characters to split on | |
max_tokens | the max number of tokens to split | |
[out] | n_tokens | the number of tokens |
References pw_array::data, pw_array::pw_array_add_ptr, pw_array::pw_array_init(), and pw_split_walk().
Referenced by pw_module::pw_module_load().
const char * pw_split_walk | ( | const char * | str, |
const char * | delimiter, | ||
size_t * | len, | ||
const char ** | state | ||
) |
Split a string based on delimiters.
str | a string to split | |
delimiter | delimiter characters to split on | |
[out] | len | the length of the current string |
[in,out] | state | a state variable |
Repeatedly call this function to split str into all substrings delimited by delimiter. state should be set to NULL on the first invocation and passed to the function until NULL is returned.
Referenced by pw_split_strv().
char * pw_strip | ( | char * | str, |
const char * | whitespace | ||
) |
Strip all whitespace before and after a string.
str | a string to strip |
whitespace | characters to strip |
Strip whitespace before and after str. str will be modified.