pipewire: parse_pw_debug_env(): split in place

There is no need to use `pw_split_strv()` since the string
is owned by the function, it can be split in place, so do that.
This commit is contained in:
Barnabás Pőcze 2023-06-23 17:17:51 +02:00
parent 656d8bbc72
commit 3506b7534c

View file

@ -520,12 +520,11 @@ parse_pw_debug_env(void)
int i; int i;
for (i = 0; i < n_tokens; i++) { for (i = 0; i < n_tokens; i++) {
int n_tok; int n_tok;
char **tok; char *tok[2];
char *pattern;
tok = pw_split_strv(tokens[i], ":", 2, &n_tok); n_tok = pw_split_ip(tokens[i], ":", SPA_N_ELEMENTS(tok), tok);
if (n_tok == 2 && parse_log_level(tok[1], &lvl)) { if (n_tok == 2 && parse_log_level(tok[1], &lvl)) {
pattern = tok[0]; char *pattern = tok[0];
pos += spa_scnprintf(pos, end - pos, "{ %s = %d },", pos += spa_scnprintf(pos, end - pos, "{ %s = %d },",
pattern, lvl); pattern, lvl);
} else if (n_tok == 1 && parse_log_level(tok[0], &lvl)) { } else if (n_tok == 1 && parse_log_level(tok[0], &lvl)) {
@ -534,8 +533,6 @@ parse_pw_debug_env(void)
pw_log_warn("Ignoring invalid format in PIPEWIRE_DEBUG: '%s'", pw_log_warn("Ignoring invalid format in PIPEWIRE_DEBUG: '%s'",
tokens[i]); tokens[i]);
} }
pw_free_strv(tok);
} }
} }
pw_free_strv(tokens); pw_free_strv(tokens);