strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0.
No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.
I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
|
||||
static int chown_cgroup_path(const char *path, uid_t uid_shift) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
const char *fn;
|
||||
|
||||
fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY);
|
||||
if (fd < 0)
|
||||
|
||||
@@ -404,7 +404,7 @@ int tmpfs_patch_options(
|
||||
}
|
||||
|
||||
int mount_sysfs(const char *dest, MountSettingsMask mount_settings) {
|
||||
const char *full, *top, *x;
|
||||
const char *full, *top;
|
||||
int r;
|
||||
unsigned long extra_flags = 0;
|
||||
|
||||
@@ -464,7 +464,7 @@ int mount_sysfs(const char *dest, MountSettingsMask mount_settings) {
|
||||
/* Create mountpoint for cgroups. Otherwise we are not allowed since we
|
||||
* remount /sys read-only.
|
||||
*/
|
||||
x = prefix_roota(top, "/fs/cgroup");
|
||||
const char *x = prefix_roota(top, "/fs/cgroup");
|
||||
(void) mkdir_p(x, 0755);
|
||||
|
||||
return mount_nofollow_verbose(LOG_ERR, NULL, top, NULL,
|
||||
|
||||
+2
-3
@@ -2564,7 +2564,7 @@ static int setup_hostname(void) {
|
||||
|
||||
static int setup_journal(const char *directory) {
|
||||
_cleanup_free_ char *d = NULL;
|
||||
const char *dirname, *p, *q;
|
||||
const char *p, *q;
|
||||
sd_id128_t this_id;
|
||||
bool try;
|
||||
int r;
|
||||
@@ -3512,7 +3512,6 @@ static int inner_child(
|
||||
(void) fdset_close_others(fds);
|
||||
|
||||
if (arg_start_mode == START_BOOT) {
|
||||
const char *init;
|
||||
char **a;
|
||||
size_t m;
|
||||
|
||||
@@ -4603,7 +4602,7 @@ static int load_settings(void) {
|
||||
_cleanup_(settings_freep) Settings *settings = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
const char *fn, *i;
|
||||
const char *fn;
|
||||
int r;
|
||||
|
||||
if (arg_oci_bundle)
|
||||
|
||||
Reference in New Issue
Block a user