[pulseaudio-discuss] [PATCH v7 03/33] pulsecore: Do in-place search in pa_str_in_list_spaces
Hajime Fujita
crisp.fujita at gmail.com
Sun Nov 6 18:53:57 UTC 2016
From: Hajime Fujita <crisp.fujita at nifty.com>
---
src/pulsecore/core-util.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 9d571b8..cd1c96d 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -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 */
bool pa_str_in_list_spaces(const char *haystack, const char *needle) {
- char *s;
+ const char *s;
+ int n;
const char *state = NULL;
if (!haystack || !needle)
return false;
- while ((s = pa_split_spaces(haystack, &state))) {
- if (pa_streq(needle, s)) {
- pa_xfree(s);
+ while ((s = pa_split_spaces_in_place(haystack, &n, &state))) {
+ if (pa_strneq(needle, s, n))
return true;
- }
-
- pa_xfree(s);
}
return false;
--
2.9.3
More information about the pulseaudio-discuss
mailing list