From: Michal Privoznik Date: Wed, 26 Nov 2025 15:32:11 +0000 (+0100) Subject: iptablesPrivateChainCreate: Rename @tmp variable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33c486f4fdc7257fb9e5ff89f5b7e3f4206b7ed0;p=thirdparty%2Flibvirt.git iptablesPrivateChainCreate: Rename @tmp variable 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 --- 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++) {