From 33c486f4fdc7257fb9e5ff89f5b7e3f4206b7ed0 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 26 Nov 2025 16:32:11 +0100 Subject: [PATCH] iptablesPrivateChainCreate: Rename @tmp variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Tested-by: Jaroslav Suchanek Reviewed-by: Ján Tomko --- src/network/network_iptables.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/network/network_iptables.c b/src/network/network_iptables.c index e8da15426e..be91b273ed 100644 --- a/src/network/network_iptables.c +++ b/src/network/network_iptables.c @@ -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++) { -- 2.47.3