mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
raop: Add pulsecore/core-utils a pa_str_in_list function
Reviewed-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
parent
6665acac56
commit
736fabf0ca
2 changed files with 23 additions and 2 deletions
|
|
@ -2981,6 +2981,26 @@ bool pa_in_system_mode(void) {
|
|||
return !!atoi(e);
|
||||
}
|
||||
|
||||
/* Checks a delimiters-separated list of words in haystack for needle */
|
||||
bool pa_str_in_list(const char *haystack, const char *delimiters, const char *needle) {
|
||||
char *s;
|
||||
const char *state = NULL;
|
||||
|
||||
if (!haystack || !needle)
|
||||
return false;
|
||||
|
||||
while ((s = pa_split(haystack, delimiters, &state))) {
|
||||
if (pa_streq(needle, s)) {
|
||||
pa_xfree(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
pa_xfree(s);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Checks a whitespace-separated list of words in haystack for needle */
|
||||
bool pa_str_in_list_spaces(const char *haystack, const char *needle) {
|
||||
char *s;
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ static inline const char *pa_strna(const char *x) {
|
|||
return x ? x : "n/a";
|
||||
}
|
||||
|
||||
char *pa_split(const char *c, const char*delimiters, const char **state);
|
||||
const char *pa_split_in_place(const char *c, const char*delimiters, int *n, const char **state);
|
||||
char *pa_split(const char *c, const char *delimiters, const char **state);
|
||||
const char *pa_split_in_place(const char *c, const char *delimiters, int *n, const char **state);
|
||||
char *pa_split_spaces(const char *c, const char **state);
|
||||
|
||||
char *pa_strip_nl(char *s);
|
||||
|
|
@ -228,6 +228,7 @@ static inline bool pa_safe_streq(const char *a, const char *b) {
|
|||
}
|
||||
|
||||
bool pa_str_in_list_spaces(const char *needle, const char *haystack);
|
||||
bool pa_str_in_list(const char *haystack, const char *delimiters, const char *needle);
|
||||
|
||||
char *pa_get_host_name_malloc(void);
|
||||
char *pa_get_user_name_malloc(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue