tree-wide: use strv_extend_strv_consume() where appropriate

This commit is contained in:
Mike Yuan
2024-09-19 23:58:00 +02:00
parent 8a7ade7427
commit a2c8652a2a
20 changed files with 54 additions and 113 deletions

View File

@@ -796,10 +796,10 @@ int replace_env_full(
t = v;
}
r = strv_extend_strv(&unset_variables, u, /* filter_duplicates= */ true);
r = strv_extend_strv_consume(&unset_variables, TAKE_PTR(u), /* filter_duplicates= */ true);
if (r < 0)
return r;
r = strv_extend_strv(&bad_variables, b, /* filter_duplicates= */ true);
r = strv_extend_strv_consume(&bad_variables, TAKE_PTR(b), /* filter_duplicates= */ true);
if (r < 0)
return r;
@@ -931,11 +931,11 @@ int replace_env_argv(
return r;
n[++k] = NULL;
r = strv_extend_strv(&unset_variables, u, /* filter_duplicates= */ true);
r = strv_extend_strv_consume(&unset_variables, TAKE_PTR(u), /* filter_duplicates= */ true);
if (r < 0)
return r;
r = strv_extend_strv(&bad_variables, b, /*filter_duplicates= */ true);
r = strv_extend_strv_consume(&bad_variables, TAKE_PTR(b), /* filter_duplicates= */ true);
if (r < 0)
return r;
}

View File

@@ -405,7 +405,7 @@ int strv_split_full(char ***t, const char *s, const char *separators, ExtractFla
}
int strv_split_and_extend_full(char ***t, const char *s, const char *separators, bool filter_duplicates, ExtractFlags flags) {
_cleanup_strv_free_ char **l = NULL;
char **l;
int r;
assert(t);
@@ -415,7 +415,7 @@ int strv_split_and_extend_full(char ***t, const char *s, const char *separators,
if (r < 0)
return r;
r = strv_extend_strv(t, l, filter_duplicates);
r = strv_extend_strv_consume(t, l, filter_duplicates);
if (r < 0)
return r;