]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
iptablesPrivateChainCreate: Rename @tmp variable
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 26 Nov 2025 15:32:11 +0000 (16:32 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Dec 2025 11:42:02 +0000 (12:42 +0100)
The iptablesPrivateChainCreate() function gets a NULL terminated
array of strings (@lines argument), each item representing one
line of iptables output. Currently, the variable used to iterate
over the array is named 'tmp' which is not very descriptive.
Rename it to 'line'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Jaroslav Suchanek <jsuchane@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/network/network_iptables.c

index e8da15426e8d095d8c3f72cfc964948336b7f924..be91b273ed866488a75583dae071d6cbd5800fbd 100644 (file)
@@ -85,26 +85,27 @@ iptablesPrivateChainCreate(virFirewall *fw,
     iptablesGlobalChainData *data = opaque;
     g_autoptr(GHashTable) chains = virHashNew(NULL);
     g_autoptr(GHashTable) links = virHashNew(NULL);
-    const char *const *tmp;
+    const char *const *line;
     size_t i;
 
-    tmp = lines;
-    while (tmp && *tmp) {
-        if (STRPREFIX(*tmp, "-N ")) { /* eg "-N LIBVIRT_INP" */
-            if (virHashUpdateEntry(chains, *tmp + 3, (void *)0x1) < 0)
+    line = lines;
+    while (line && *line) {
+        if (STRPREFIX(*line, "-N ")) { /* eg "-N LIBVIRT_INP" */
+            if (virHashUpdateEntry(chains, *line + 3, (void *)0x1) < 0)
                 return -1;
-        } else if (STRPREFIX(*tmp, "-A ")) { /* eg "-A INPUT -j LIBVIRT_INP" */
-            char *sep = strchr(*tmp + 3, ' ');
+        } else if (STRPREFIX(*line, "-A ")) { /* eg "-A INPUT -j LIBVIRT_INP" */
+            char *sep = strchr(*line + 3, ' ');
+
             if (sep) {
                 *sep = '\0';
                 if (STRPREFIX(sep + 1, "-j ")) {
                     if (virHashUpdateEntry(links, sep + 4,
-                                           (char *)*tmp + 3) < 0)
+                                           (char *)*line + 3) < 0)
                         return -1;
                 }
             }
         }
-        tmp++;
+        line++;
     }
 
     for (i = 0; i < data->nchains; i++) {