From b2238e380e5f2fbcc129643b3fbd66f2828fd57c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 16 Jan 2019 00:12:50 +0100 Subject: [PATCH] test,systemctl,nspawn: use "const char*" instead of "char*" as iterator for FOREACH_STRING() The macro iterates through literal strings (i.e. constant strings), hence it's more correct to have the iterator const too. --- src/nspawn/nspawn.c | 6 +++--- src/systemctl/systemctl.c | 4 ++-- src/test/test-execute.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 91c97b6..8e81f40 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1964,11 +1964,11 @@ static int setup_hostname(void) { } static int setup_journal(const char *directory) { - sd_id128_t this_id; _cleanup_free_ char *d = NULL; - const char *p, *q; + const char *dirname, *p, *q; + sd_id128_t this_id; + char id[33]; bool try; - char id[33], *dirname; int r; /* Don't link journals in ephemeral mode */ diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 629f9cb..63dae2c 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -6933,9 +6933,9 @@ static int run_editor(char **paths) { if (r < 0) return r; if (r == 0) { - char **editor_args = NULL, **tmp_path, **original_path, *p; + char **editor_args = NULL, **tmp_path, **original_path; size_t n_editor_args = 0, i = 1, argc; - const char **args, *editor; + const char **args, *editor, *p; argc = strv_length(paths)/2 + 1; diff --git a/src/test/test-execute.c b/src/test/test-execute.c index cea68b8..4c240ff 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -131,7 +131,7 @@ static bool check_user_has_group_with_same_name(const char *name) { } static bool is_inaccessible_available(void) { - char *p; + const char *p; FOREACH_STRING(p, "/run/systemd/inaccessible/reg", -- 2.7.4