mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
core-util: do in-place search in pa_str_in_list_spaces
Reviewed-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
parent
04b46803cd
commit
43bf134aa1
1 changed files with 4 additions and 7 deletions
|
|
@ -3022,19 +3022,16 @@ bool pa_str_in_list(const char *haystack, const char *delimiters, const char *ne
|
||||||
|
|
||||||
/* Checks a whitespace-separated list of words in haystack for needle */
|
/* Checks a whitespace-separated list of words in haystack for needle */
|
||||||
bool pa_str_in_list_spaces(const char *haystack, const char *needle) {
|
bool pa_str_in_list_spaces(const char *haystack, const char *needle) {
|
||||||
char *s;
|
const char *s;
|
||||||
|
int n;
|
||||||
const char *state = NULL;
|
const char *state = NULL;
|
||||||
|
|
||||||
if (!haystack || !needle)
|
if (!haystack || !needle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while ((s = pa_split_spaces(haystack, &state))) {
|
while ((s = pa_split_spaces_in_place(haystack, &n, &state))) {
|
||||||
if (pa_streq(needle, s)) {
|
if (pa_strneq(needle, s, n))
|
||||||
pa_xfree(s);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
pa_xfree(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue