]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nulstr-util: Declare NULSTR_FOREACH() iterator inline
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 11 Nov 2022 11:08:26 +0000 (12:08 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 11 Nov 2022 15:31:32 +0000 (16:31 +0100)
44 files changed:
src/analyze/analyze-cat-config.c
src/analyze/analyze-filesystems.c
src/analyze/analyze-security.c
src/analyze/analyze-syscall-filter.c
src/basic/filesystems.c
src/basic/nulstr-util.c
src/basic/nulstr-util.h
src/basic/path-lookup.c
src/basic/strv.c
src/core/bpf-devices.c
src/core/bpf-lsm.c
src/core/load-fragment.c
src/core/namespace.c
src/cryptsetup/cryptsetup.c
src/delta/delta.c
src/home/homework-fscrypt.c
src/journal/journalctl.c
src/libsystemd/sd-device/device-private.c
src/libsystemd/sd-device/test-sd-device.c
src/libsystemd/sd-hwdb/sd-hwdb.c
src/libsystemd/sd-journal/sd-journal.c
src/locale/localed-util.c
src/machine/machinectl.c
src/nspawn/nspawn.c
src/resolve/resolved-dns-trust-anchor.c
src/shared/base-filesystem.c
src/shared/cgroup-show.c
src/shared/conf-parser.c
src/shared/copy.c
src/shared/dev-setup.c
src/shared/discover-image.c
src/shared/dissect-image.c
src/shared/fstab-util.c
src/shared/hwdb-util.c
src/shared/import-util.c
src/shared/kbd-util.c
src/shared/seccomp-util.c
src/test/test-compress-benchmark.c
src/test/test-condition.c
src/test/test-hashmap-plain.c
src/test/test-sd-hwdb.c
src/test/test-seccomp.c
src/test/test-strv.c
src/udev/udev-rules.c

index a30662b49f70c7b83ed79ac8265849f53e6569ed..08184cedfe2fc8f8ff57efae451d94fbae246499 100644 (file)
@@ -23,8 +23,6 @@ int verb_cat_config(int argc, char *argv[], void *userdata) {
                         print_separator();
 
                 if (path_is_absolute(*arg)) {
-                        const char *dir;
-
                         NULSTR_FOREACH(dir, CONF_PATHS_NULSTR("")) {
                                 t = path_startswith(*arg, dir);
                                 if (t)
index e30b3a6ac6d7b8a0aa13a3fbfc08ab251dcf0c18..582e04eac9132866368b806df11ca05bbbd5041c 100644 (file)
@@ -50,8 +50,6 @@ static int load_available_kernel_filesystems(Set **ret) {
 }
 
 static void filesystem_set_remove(Set *s, const FilesystemSet *set) {
-        const char *filesystem;
-
         NULSTR_FOREACH(filesystem, set->value) {
                 if (filesystem[0] == '@')
                         continue;
@@ -61,7 +59,6 @@ static void filesystem_set_remove(Set *s, const FilesystemSet *set) {
 }
 
 static void dump_filesystem_set(const FilesystemSet *set) {
-        const char *filesystem;
         int r;
 
         if (!set)
@@ -119,7 +116,6 @@ int verb_filesystems(int argc, char *argv[], void *userdata) {
 
         if (strv_isempty(strv_skip(argv, 1))) {
                 _cleanup_set_free_ Set *kernel = NULL, *known = NULL;
-                const char *fs;
                 int k;
 
                 NULSTR_FOREACH(fs, filesystem_sets[FILESYSTEM_SET_KNOWN].value)
index 69eab91bdb6719cca1e589c77ca1d858d68076a7..585dd01f689fffdd2ff806005b00a89bf4c44aff 100644 (file)
@@ -567,8 +567,6 @@ static int assess_system_call_architectures(
 }
 
 static bool syscall_names_in_filter(Set *s, bool allow_list, const SyscallFilterSet *f, const char **ret_offending_syscall) {
-        const char *syscall;
-
         NULSTR_FOREACH(syscall, f->value) {
                 if (syscall[0] == '@') {
                         const SyscallFilterSet *g;
index 308b1724e5d56d7c20393b5192e8101684448b07..50662da0627095abec1e141798d28991f52d00c3 100644 (file)
@@ -59,8 +59,6 @@ static int load_kernel_syscalls(Set **ret) {
 }
 
 static void syscall_set_remove(Set *s, const SyscallFilterSet *set) {
-        const char *syscall;
-
         if (!set)
                 return;
 
@@ -73,8 +71,6 @@ static void syscall_set_remove(Set *s, const SyscallFilterSet *set) {
 }
 
 static void dump_syscall_filter(const SyscallFilterSet *set) {
-        const char *syscall;
-
         printf("%s%s%s\n"
                "    # %s\n",
                ansi_highlight(),
@@ -93,7 +89,6 @@ int verb_syscall_filters(int argc, char *argv[], void *userdata) {
 
         if (strv_isempty(strv_skip(argv, 1))) {
                 _cleanup_set_free_ Set *kernel = NULL, *known = NULL;
-                const char *sys;
                 int k = 0;  /* explicit initialization to appease gcc */
 
                 NULSTR_FOREACH(sys, syscall_filter_sets[SYSCALL_FILTER_SET_KNOWN].value)
index b11cbb9d65a1c417be269878d3a4e423e269547a..7d34e4e9ad0489cfaeca8a25f444e0bcab7a5124 100644 (file)
@@ -28,7 +28,6 @@ int fs_type_from_string(const char *name, const statfs_f_type_t **ret) {
 }
 
 bool fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
-        const char *fs;
         int r;
 
         NULSTR_FOREACH(fs, filesystem_sets[fs_group].value) {
index dbafc8c4c94544fc0f1f553d20eba71dac6ca777..8eb19256a96dfde8f78539bf7783a13cf11d3fd5 100644 (file)
@@ -4,8 +4,6 @@
 #include "string-util.h"
 
 const char* nulstr_get(const char *nulstr, const char *needle) {
-        const char *i;
-
         if (!nulstr)
                 return NULL;
 
index 1d1fbc19c04284d9b64327f327b5ab280e2f9f42..26bf7be871dc7da5d00863a2da74079e4c42dde8 100644 (file)
@@ -5,10 +5,10 @@
 #include <string.h>
 
 #define NULSTR_FOREACH(i, l)                                    \
-        for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
+        for (typeof(*(l)) *(i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
 
 #define NULSTR_FOREACH_PAIR(i, j, l)                             \
-        for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
+        for (typeof(*(l)) *(i) = (l), *(j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
 
 const char* nulstr_get(const char *nulstr, const char *needle);
 
index 36f386254b72e7432f73584fafc2efd89ec202be..c99e9d8786cb1d7b1f21ae1a0cab82b9ee4960ad 100644 (file)
@@ -880,7 +880,7 @@ char **env_generator_binary_paths(bool is_system) {
 }
 
 int find_portable_profile(const char *name, const char *unit, char **ret_path) {
-        const char *p, *dot;
+        const char *dot;
 
         assert(name);
         assert(ret_path);
index 24fc56a1a5cafcfbd53cdfdd92d7a8f4506da57b..7d9bf8d63a36815354ccea99a709b397ba8246dd 100644 (file)
@@ -679,7 +679,6 @@ char** strv_parse_nulstr(const char *s, size_t l) {
 }
 
 char** strv_split_nulstr(const char *s) {
-        const char *i;
         char **r = NULL;
 
         NULSTR_FOREACH(i, s)
index 3af9e78a1e32f5e9f2987d115da3002cb0b77d92..c79cda5b76d9cacfc06339f827aaa6961b3a13d8 100644 (file)
@@ -515,7 +515,6 @@ int bpf_devices_allow_list_static(
                 "/run/systemd/inaccessible/blk\0" "rwm\0";
         int r = 0, k;
 
-        const char *node, *acc;
         NULSTR_FOREACH_PAIR(node, acc, auto_devices) {
                 k = bpf_devices_allow_list_device(prog, path, node, acc);
                 if (r >= 0 && k < 0)
index 173221b9f178eb1c0e981d5658fe74f422cc9373..de601c48d751ffce39a7ba12a6c5e0254edaf451 100644 (file)
@@ -326,7 +326,6 @@ int lsm_bpf_parse_filesystem(
 
         if (name[0] == '@') {
                 const FilesystemSet *set;
-                const char *i;
 
                 set = filesystem_set_find(name);
                 if (!set) {
index 1a5895346d96633561d2a624068b91871e193386..49d3c0359141c880993fda3f5e4b009d6f8ba59f 100644 (file)
@@ -6226,7 +6226,6 @@ void unit_dump_config_items(FILE *f) {
         };
 
         const char *prev = NULL;
-        const char *i;
 
         assert(f);
 
index 852be3bdde82880e43a931841865ff06e7356491..7752e48fb0bfbb8f0e8cc0a4033f60722e556f58 100644 (file)
@@ -916,7 +916,7 @@ static int mount_private_dev(MountEntry *m) {
                 "/dev/tty\0";
 
         char temporary_mount[] = "/tmp/namespace-dev-XXXXXX";
-        const char *d, *dev = NULL, *devpts = NULL, *devshm = NULL, *devhugepages = NULL, *devmqueue = NULL, *devlog = NULL, *devptmx = NULL;
+        const char *dev = NULL, *devpts = NULL, *devshm = NULL, *devhugepages = NULL, *devmqueue = NULL, *devlog = NULL, *devptmx = NULL;
         bool can_mknod = true;
         int r;
 
index 7aa36b4b032f54b1139719db78d0b8a68e771eb3..90b5ab21a991d5df63f691eca77a85aa189c56fc 100644 (file)
@@ -494,7 +494,7 @@ static char* disk_description(const char *path) {
                 "ID_MODEL\0";
 
         _cleanup_(sd_device_unrefp) sd_device *device = NULL;
-        const char *i, *name;
+        const char *name;
         struct stat st;
 
         assert(path);
index da648bc837dbfb40ee21cf301e9f3d208e12a5c5..db6e957fc9d51ee9a083a641629033a29e0197ed 100644 (file)
@@ -371,7 +371,6 @@ static int enumerate_dir(
 static int should_skip_path(const char *prefix, const char *suffix) {
 #if HAVE_SPLIT_USR
         _cleanup_free_ char *target = NULL, *dirname = NULL;
-        const char *p;
 
         dirname = path_join(prefix, suffix);
         if (!dirname)
@@ -400,7 +399,6 @@ static int should_skip_path(const char *prefix, const char *suffix) {
 }
 
 static int process_suffix(const char *suffix, const char *onlyprefix) {
-        const char *p;
         char *f, *key;
         OrderedHashmap *top, *bottom, *drops, *h;
         int r = 0, k, n_found = 0;
@@ -477,7 +475,6 @@ finish:
 }
 
 static int process_suffixes(const char *onlyprefix) {
-        const char *n;
         int n_found = 0, r;
 
         NULSTR_FOREACH(n, suffixes) {
@@ -492,8 +489,6 @@ static int process_suffixes(const char *onlyprefix) {
 }
 
 static int process_suffix_chop(const char *arg) {
-        const char *p;
-
         assert(arg);
 
         if (!path_is_absolute(arg))
index 5106961f38bdef6ec55b3967699f166c9b99dca7..f29c55c8952b05dc5859efbc777f7f0f3f13e43a 100644 (file)
@@ -216,7 +216,6 @@ static int fscrypt_setup(
                 size_t *ret_volume_key_size) {
 
         _cleanup_free_ char *xattr_buf = NULL;
-        const char *xa;
         int r;
 
         assert(setup);
@@ -646,7 +645,6 @@ int home_passwd_fscrypt(
         _cleanup_free_ char *xattr_buf = NULL;
         size_t volume_key_size = 0;
         uint32_t slot = 0;
-        const char *xa;
         int r;
 
         assert(h);
index eb8106cbb41fadb28a11ef69d1de862ac1d5a0d9..ba5636af141d38ccda6453e86c5391e033f87d5c 100644 (file)
@@ -1512,7 +1512,6 @@ static int get_possible_units(
                 Set **units) {
 
         _cleanup_set_free_free_ Set *found = NULL;
-        const char *field;
         int r;
 
         found = set_new(&string_hash_ops);
index bc7a838608996b81df0497e15d9a6c0006d99813..7cda48c4cafb8ef0bcaf9e655d4344782eb86213 100644 (file)
@@ -559,7 +559,6 @@ static int device_update_properties_bufs(sd_device *device) {
                 return -ENOMEM;
 
         size_t i = 0;
-        char *p;
         NULSTR_FOREACH(p, buf_nulstr)
                 buf_strv[i++] = p;
         assert(i == num);
index 4ab8b3894ae3737498c2557bcc924d92ed490254..32ee6707013f4c691ebd01015b7fc320f2871efa 100644 (file)
@@ -534,7 +534,7 @@ TEST(sd_device_new_from_nulstr) {
 
         _cleanup_(sd_device_unrefp) sd_device *device = NULL, *from_nulstr = NULL;
         _cleanup_free_ char *nulstr_copy = NULL;
-        const char *devlink, *nulstr;
+        const char *nulstr;
         size_t len;
 
         assert_se(sd_device_new_from_syspath(&device, "/sys/class/net/lo") >= 0);
index 51be54b1e14ceff3e7166bd57438d3ad0b09f527..f163314f7c3ac1153b534eb601fc94f29eaf96db 100644 (file)
@@ -300,13 +300,15 @@ static int hwdb_new(const char *path, sd_hwdb **ret) {
                 if (!hwdb->f)
                         return log_debug_errno(errno, "Failed to open %s: %m", path);
         } else {
-                NULSTR_FOREACH(path, hwdb_bin_paths) {
-                        log_debug("Trying to open \"%s\"...", path);
-                        hwdb->f = fopen(path, "re");
-                        if (hwdb->f)
+                NULSTR_FOREACH(p, hwdb_bin_paths) {
+                        log_debug("Trying to open \"%s\"...", p);
+                        hwdb->f = fopen(p, "re");
+                        if (hwdb->f) {
+                                path = p;
                                 break;
+                        }
                         if (errno != ENOENT)
-                                return log_debug_errno(errno, "Failed to open %s: %m", path);
+                                return log_debug_errno(errno, "Failed to open %s: %m", p);
                 }
 
                 if (!hwdb->f)
index 53c0b2a01e93f6b2baf86afca650f6c4d6825f0e..aa90d873a5741a10aefb2c2bd3d6ed2112b7cb59 100644 (file)
@@ -1828,7 +1828,6 @@ static int add_search_paths(sd_journal *j) {
         static const char search_paths[] =
                 "/run/log/journal\0"
                 "/var/log/journal\0";
-        const char *p;
 
         assert(j);
 
index dd2bbf5bfb80a58e1d2256c2bced26854b498fcc..880d0d209c5c35e020e45db27540aa8cb6ce517d 100644 (file)
@@ -432,7 +432,6 @@ int vconsole_convert_to_x11(Context *c) {
 }
 
 int find_converted_keymap(const char *x11_layout, const char *x11_variant, char **new_keymap) {
-        const char *dir;
         _cleanup_free_ char *n = NULL;
 
         if (x11_variant)
index af0f5d861206a9837eb84f2d1288e4f1aeac2680..93761a1da9bdff993b5a7a25f8c347025246d7c2 100644 (file)
@@ -98,7 +98,7 @@ static OutputFlags get_output_flags(void) {
 static int call_get_os_release(sd_bus *bus, const char *method, const char *name, const char *query, ...) {
         _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
-        const char *k, *v, *iter, **query_res = NULL;
+        const char *k, *v, **query_res = NULL;
         size_t count = 0, awaited_args = 0;
         va_list ap;
         int r;
index fb9fbed12cbed749e108df2fde5f6349b46c4766..ef5825ef7573c2ea80d2882058ea3bc56c8287ec 100644 (file)
@@ -2219,7 +2219,6 @@ static int copy_devnodes(const char *dest) {
                 "tty\0"
                 "net/tun\0";
 
-        const char *d;
         int r = 0;
 
         assert(dest);
index 828045f68fb878e728839b4848d9e8dc8bde6982..ca670b30f1e63d8ec787aebd0819570ad40169f8 100644 (file)
@@ -165,7 +165,6 @@ static int dns_trust_anchor_add_builtin_negative(DnsTrustAnchor *d) {
                 /* Defined by RFC 8375. The most official choice. */
                 "home.arpa\0";
 
-        const char *name;
         int r;
 
         assert(d);
index 5b4f674ec2b01b3516f861e356d9b5fdf1765356..c2902d35082e40b9d26a69269a64e634885ae518 100644 (file)
@@ -135,7 +135,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
                         continue;
 
                 if (table[i].target) {
-                        const char *target = NULL, *s;
+                        const char *target = NULL;
 
                         /* check if one of the targets exists */
                         NULSTR_FOREACH(s, table[i].target) {
index e34a68ef8696ae1dc112029aabd6d3b506f9958f..e6f67fc714920e5a61a868202157b3f0b670a27b 100644 (file)
@@ -211,7 +211,6 @@ static int show_cgroup_name(
 
         if (FLAGS_SET(flags, OUTPUT_CGROUP_XATTRS) && fd >= 0) {
                 _cleanup_free_ char *nl = NULL;
-                char *xa;
 
                 r = flistxattr_malloc(fd, &nl);
                 if (r < 0)
index 69932865ba59fc33ceddd8e30012e8847288228c..29051ca0e34b11af116945c3f35e05998c7f3a6d 100644 (file)
@@ -211,7 +211,6 @@ static int parse_line(
 
                 if (sections && !nulstr_contains(sections, n)) {
                         bool ignore;
-                        const char *t;
 
                         ignore = (flags & CONFIG_PARSE_RELAXED) || startswith(n, "X-");
 
index 49d2fd940043c5e8b4cba27e712f21f5c9cc94a2..2b492c38a5af63a2fba1453a2b86b84dd260f7fa 100644 (file)
@@ -1555,7 +1555,6 @@ int copy_rights_with_fallback(int fdf, int fdt, const char *patht) {
 int copy_xattr(int fdf, int fdt, CopyFlags copy_flags) {
         _cleanup_free_ char *names = NULL;
         int ret = 0, r;
-        const char *p;
 
         r = flistxattr_malloc(fdf, &names);
         if (r < 0)
index a34052451034dfacc697d6aa053142a902afb06f..e0db777c96effafc3e2c40c333ecb0050c0f5852 100644 (file)
@@ -22,7 +22,6 @@ int dev_setup(const char *prefix, uid_t uid, gid_t gid) {
                 "/proc/self/fd/1\0"  "/dev/stdout\0"
                 "/proc/self/fd/2\0"  "/dev/stderr\0";
 
-        const char *j, *k;
         int r;
 
         NULSTR_FOREACH_PAIR(j, k, symlinks) {
index fad95f7f435ccf5032c4dcc82d6950201a34a32d..073e5e84338d50f0881bc4ad992e0774720c234d 100644 (file)
@@ -429,7 +429,6 @@ int image_find(ImageClass class,
                const char *root,
                Image **ret) {
 
-        const char *path;
         int r;
 
         assert(class >= 0);
@@ -533,7 +532,6 @@ int image_discover(
                 const char *root,
                 Hashmap *h) {
 
-        const char *path;
         int r;
 
         assert(class >= 0);
@@ -1262,8 +1260,6 @@ bool image_in_search_path(
                 const char *root,
                 const char *image) {
 
-        const char *path;
-
         assert(image);
 
         NULSTR_FOREACH(path, image_search_path[class]) {
index 1214a172638908f0e28a1c4d7da57a51b9a5343a..a027973e0442c6774be114ca230955746a641c88 100644 (file)
@@ -2869,7 +2869,6 @@ int dissected_image_acquire_metadata(DissectedImage *m, DissectImageFlags extra_
 
                 for (unsigned k = 0; k < _META_MAX; k++) {
                         _cleanup_close_ int fd = -ENOENT;
-                        const char *p;
 
                         if (!paths[k])
                                 continue;
index 3cbc6be248b3bab2f83cae32dd130820107dd4cc..164e71a150d0d9f1d2c139168987093a233714f9 100644 (file)
@@ -88,7 +88,7 @@ int fstab_filter_options(
                 char ***ret_values,
                 char **ret_filtered) {
 
-        const char *name, *namefound = NULL, *x;
+        const char *namefound = NULL, *x;
         _cleanup_strv_free_ char **stor = NULL, **values = NULL;
         _cleanup_free_ char *value = NULL, **filtered = NULL;
         int r;
@@ -127,17 +127,17 @@ int fstab_filter_options(
                                 if (!x)
                                         continue;
                                 /* Match name, but when ret_values, only when followed by assignment. */
-                                if (*x == '=' || (!ret_values && *x == '\0'))
+                                if (*x == '=' || (!ret_values && *x == '\0')) {
+                                        /* Keep the last occurrence found */
+                                        namefound = name;
                                         goto found;
+                                }
                         }
 
                         *t = *s;
                         t++;
                         continue;
                 found:
-                        /* Keep the last occurrence found */
-                        namefound = name;
-
                         if (ret_value || ret_values) {
                                 assert(IN_SET(*x, '=', '\0'));
 
index 6a680fb3be1b7747a5a86ee577a8134f10439e68..0ff686d24b65a478f00bcb37d1d33e8e33e3536e 100644 (file)
@@ -652,7 +652,7 @@ int hwdb_update(const char *root, const char *hwdb_bin_dir, bool strict, bool co
 
 int hwdb_query(const char *modalias, const char *root) {
         _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
-        const char *key, *value, *p;
+        const char *key, *value;
         int r;
 
         assert(modalias);
@@ -682,7 +682,6 @@ int hwdb_query(const char *modalias, const char *root) {
 
 bool hwdb_should_reload(sd_hwdb *hwdb) {
         bool found = false;
-        const char* p;
         struct stat st;
 
         if (!hwdb)
index 97d39ee04777bc6dcf1760895ecfeba039e2b573..ec8906450611491777ff81ca6175c35152746bdd 100644 (file)
@@ -179,7 +179,6 @@ int raw_strip_suffixes(const char *p, char **ret) {
                 return -ENOMEM;
 
         for (;;) {
-                const char *sfx;
                 bool changed = false;
 
                 NULSTR_FOREACH(sfx, suffixes) {
index 842ff3066b4151a2fa89c2d3bae51e0ded9ff6c3..6222ef4fc81c4d50864833e4ec76e7dfc72e0227 100644 (file)
@@ -71,7 +71,6 @@ int get_keymaps(char ***ret) {
         if (!keymaps)
                 return -ENOMEM;
 
-        const char *dir;
         NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) {
                 r = recurse_dir_at(
                                 AT_FDCWD,
@@ -135,7 +134,6 @@ int keymap_exists(const char *name) {
         if (!keymap_is_valid(name))
                 return -EINVAL;
 
-        const char *dir;
         NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) {
                 r = recurse_dir_at(
                                 AT_FDCWD,
index dfac4da7cc364c057be18c882dc7c9ebaac5198d..8ece7f163f1be53370957aff2e2cfc61bce90814 100644 (file)
@@ -1039,7 +1039,6 @@ static int add_syscall_filter_set(
                 bool log_missing,
                 char ***added) {
 
-        const char *sys;
         int r;
 
         /* Any syscalls that are handled are added to the *added strv. It needs to be initialized. */
@@ -1169,7 +1168,6 @@ int seccomp_parse_syscall_filter(
 
         if (name[0] == '@') {
                 const SyscallFilterSet *set;
-                const char *i;
 
                 set = syscall_filter_set_find(name);
                 if (!set) {
@@ -1909,7 +1907,6 @@ int parse_syscall_archs(char **l, Set **ret_archs) {
 }
 
 int seccomp_filter_set_add(Hashmap *filter, bool add, const SyscallFilterSet *set) {
-        const char *i;
         int r;
 
         assert(set);
@@ -2308,7 +2305,6 @@ int seccomp_suppress_sync(void) {
 
         SECCOMP_FOREACH_LOCAL_ARCH(arch) {
                 _cleanup_(seccomp_releasep) scmp_filter_ctx seccomp = NULL;
-                const char *c;
 
                 r = seccomp_init_for_arch(&seccomp, arch, SCMP_ACT_ALLOW);
                 if (r < 0)
index 3f8225cbcc1a48832e081d91adc15eee4dd6ea08..da0f5e137a75ea669301101d080ae27fc9985ad1 100644 (file)
@@ -158,7 +158,6 @@ int main(int argc, char *argv[]) {
         else
                 arg_start = getpid_cached();
 
-        const char *i;
         NULSTR_FOREACH(i, "zeros\0simple\0random\0") {
 #if HAVE_XZ
                 test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz);
index 4cd23d8e2135bba4ec65f986a66894bd5aa9f9ab..5144eb4687298a55433ef60ae202120e84edd955 100644 (file)
@@ -800,7 +800,6 @@ TEST(print_securities) {
 
 TEST(condition_test_virtualization) {
         Condition *condition;
-        const char *virt;
         int r;
 
         condition = condition_new(CONDITION_VIRTUALIZATION, "garbage oifdsjfoidsjoj", false, false);
index 36a775012b3c742971e2d56628ba997f3937bbda..fea20d82a6783245155b94252aadfd57361438ca 100644 (file)
@@ -452,8 +452,8 @@ TEST(hashmap_foreach_key) {
 
         m = hashmap_new(&string_hash_ops);
 
-        NULSTR_FOREACH(key, key_table)
-                hashmap_put(m, key, (void*) (const char*) "my dummy val");
+        NULSTR_FOREACH(k, key_table)
+                hashmap_put(m, k, (void*) (const char*) "my dummy val");
 
         HASHMAP_FOREACH_KEY(s, key, m) {
                 assert_se(s);
index f18634cc34e32fc2251f2f2cd7db7f4d406056ba..ecb6118bcaf678f5531972b628bb734fb559731f 100644 (file)
@@ -56,7 +56,6 @@ TEST(basic_enumerate) {
 
 TEST(sd_hwdb_new_from_path) {
         _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL;
-        const char *hwdb_bin_path = NULL;
         int r;
 
         assert_se(sd_hwdb_new_from_path(NULL, &hwdb) == -EINVAL);
index 4c704badbd71ca0320b392f3e0b409a5459ab261..ae311c56868295d88aa44799008e7bae63ff5963 100644 (file)
@@ -117,7 +117,7 @@ TEST(seccomp_arch_to_string) {
 }
 
 TEST(architecture_table) {
-        const char *n, *n2;
+        const char *n2;
 
         NULSTR_FOREACH(n,
                        "native\0"
@@ -234,7 +234,7 @@ TEST(filter_sets_ordered) {
         assert_se(streq(syscall_filter_sets[SYSCALL_FILTER_SET_KNOWN].name, "@known"));
 
         for (size_t i = 0; i < _SYSCALL_FILTER_SET_MAX; i++) {
-                const char *k, *p = NULL;
+                const char *p = NULL;
 
                 /* Make sure each group has a description */
                 assert_se(!isempty(syscall_filter_sets[0].help));
index b892396f05bf8c92a75802d0a964fa4952570b31..debb922f856d9caad4fff4b3cf55cf980967a5f0 100644 (file)
@@ -948,7 +948,6 @@ TEST(strv_extend_n) {
 static void test_strv_make_nulstr_one(char **l) {
         _cleanup_free_ char *b = NULL, *c = NULL;
         _cleanup_strv_free_ char **q = NULL;
-        const char *s = NULL;
         size_t n, m;
         unsigned i = 0;
 
index 5f837f4c31e649c7bd023a84dcb55022bb231135..3b0cdda74e0bfdc106faed9a0b37f15722360e73 100644 (file)
@@ -1341,7 +1341,7 @@ bool udev_rules_should_reload(UdevRules *rules) {
 }
 
 static bool token_match_string(UdevRuleToken *token, const char *str) {
-        const char *i, *value;
+        const char *value;
         bool match = false;
 
         assert(token);