strv: make iterator in STRV_FOREACH() declaread in the loop
This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
This commit is contained in:
@@ -51,8 +51,6 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Option*, option_free);
|
||||
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(option_hash_ops, char, string_hash_func, string_compare_func, Option, option_free);
|
||||
|
||||
static bool test_prefix(const char *p) {
|
||||
char **i;
|
||||
|
||||
if (strv_isempty(arg_prefixes))
|
||||
return true;
|
||||
|
||||
@@ -131,7 +129,6 @@ static int apply_all(OrderedHashmap *sysctl_options) {
|
||||
if (string_is_glob(option->key)) {
|
||||
_cleanup_strv_free_ char **paths = NULL;
|
||||
_cleanup_free_ char *pattern = NULL;
|
||||
char **s;
|
||||
|
||||
pattern = path_join("/proc/sys", option->key);
|
||||
if (!pattern)
|
||||
@@ -403,7 +400,6 @@ static int run(int argc, char *argv[]) {
|
||||
}
|
||||
} else {
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **f;
|
||||
|
||||
r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d"));
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user