diff mbox series

define "i" only if attr is NFTNL_CHAIN_DEVICES. When attr isn't NFTNL_CHAIN_DEVICES, "i" is useless.

Message ID 20230605160016.105485-1-tongxiaoge1001@126.com
State Not Applicable
Delegated to: Pablo Neira
Headers show
Series define "i" only if attr is NFTNL_CHAIN_DEVICES. When attr isn't NFTNL_CHAIN_DEVICES, "i" is useless. | expand

Commit Message

tongxiaoge1001@126.com June 5, 2023, 4 p.m. UTC
From: shixuantong <tongxiaoge1001@126.com>

---
 src/chain.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/chain.c b/src/chain.c
index dcfcd04..eb2cba7 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -150,8 +150,6 @@  bool nftnl_chain_is_set(const struct nftnl_chain *c, uint16_t attr)
 EXPORT_SYMBOL(nftnl_chain_unset);
 void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
 {
-	int i;
-
 	if (!(c->flags & (1 << attr)))
 		return;
 
@@ -181,7 +179,7 @@  void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
 		xfree(c->dev);
 		break;
 	case NFTNL_CHAIN_DEVICES:
-		for (i = 0; i < c->dev_array_len; i++)
+		for (int i = 0; i < c->dev_array_len; i++)
 			xfree(c->dev_array[i]);
 		xfree(c->dev_array);
 		break;