git: f5e73306336f - main - ipfw: Remove set but unused variables.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 27 Jun 2023 17:19:41 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f5e73306336f22b842da143f973f08c5dcd13671

commit f5e73306336f22b842da143f973f08c5dcd13671
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-06-27 17:19:32 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-06-27 17:19:32 +0000

    ipfw: Remove set but unused variables.
    
    Reported by:    GCC
    Differential Revision:  https://reviews.freebsd.org/D40654
---
 sbin/ipfw/nat.c       | 3 +--
 sbin/ipfw/nat64clat.c | 3 +--
 sbin/ipfw/nat64lsn.c  | 3 +--
 sbin/ipfw/nat64stl.c  | 3 +--
 sbin/ipfw/nptv6.c     | 3 +--
 sbin/ipfw/tables.c    | 6 ++----
 6 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index 1076e1038b8a..2be03f47c229 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -1074,7 +1074,6 @@ nat_foreach(nat_cb_t *f, void *arg, int sort)
 	struct nat44_cfg_nat *cfg;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(struct nat44_cfg_nat);
@@ -1097,7 +1096,7 @@ nat_foreach(nat_cb_t *f, void *arg, int sort)
 
 		cfg = (struct nat44_cfg_nat*)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(cfg, arg); /* Ignore errors for now */
+			(void)f(cfg, arg); /* Ignore errors for now */
 			cfg = (struct nat44_cfg_nat *)((caddr_t)cfg +
 			    olh->objsize);
 		}
diff --git a/sbin/ipfw/nat64clat.c b/sbin/ipfw/nat64clat.c
index 08be444318cc..bd286f78cfc2 100644
--- a/sbin/ipfw/nat64clat.c
+++ b/sbin/ipfw/nat64clat.c
@@ -505,7 +505,6 @@ nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, int sort)
 	ipfw_nat64clat_cfg *cfg;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(*cfg);
@@ -528,7 +527,7 @@ nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, int sort)
 
 		cfg = (ipfw_nat64clat_cfg *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(cfg, name, set); /* Ignore errors for now */
+			(void)f(cfg, name, set); /* Ignore errors for now */
 			cfg = (ipfw_nat64clat_cfg *)((caddr_t)cfg +
 			    olh->objsize);
 		}
diff --git a/sbin/ipfw/nat64lsn.c b/sbin/ipfw/nat64lsn.c
index 755414f49959..f005432d7fbc 100644
--- a/sbin/ipfw/nat64lsn.c
+++ b/sbin/ipfw/nat64lsn.c
@@ -853,7 +853,6 @@ nat64lsn_foreach(nat64lsn_cb_t *f, const char *name, uint8_t set,  int sort)
 	ipfw_nat64lsn_cfg *cfg;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(ipfw_nat64lsn_cfg);
@@ -877,7 +876,7 @@ nat64lsn_foreach(nat64lsn_cb_t *f, const char *name, uint8_t set,  int sort)
 
 		cfg = (ipfw_nat64lsn_cfg *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(cfg, name, set); /* Ignore errors for now */
+			(void)f(cfg, name, set); /* Ignore errors for now */
 			cfg = (ipfw_nat64lsn_cfg *)((caddr_t)cfg +
 			    olh->objsize);
 		}
diff --git a/sbin/ipfw/nat64stl.c b/sbin/ipfw/nat64stl.c
index def9b9dd9b58..8ac0b546a44d 100644
--- a/sbin/ipfw/nat64stl.c
+++ b/sbin/ipfw/nat64stl.c
@@ -521,7 +521,6 @@ nat64stl_foreach(nat64stl_cb_t *f, const char *name, uint8_t set, int sort)
 	ipfw_nat64stl_cfg *cfg;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(*cfg);
@@ -544,7 +543,7 @@ nat64stl_foreach(nat64stl_cb_t *f, const char *name, uint8_t set, int sort)
 
 		cfg = (ipfw_nat64stl_cfg *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(cfg, name, set); /* Ignore errors for now */
+			(void)f(cfg, name, set); /* Ignore errors for now */
 			cfg = (ipfw_nat64stl_cfg *)((caddr_t)cfg +
 			    olh->objsize);
 		}
diff --git a/sbin/ipfw/nptv6.c b/sbin/ipfw/nptv6.c
index f2ebbdb65185..27b6d3945d26 100644
--- a/sbin/ipfw/nptv6.c
+++ b/sbin/ipfw/nptv6.c
@@ -420,7 +420,6 @@ nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, int sort)
 	ipfw_nptv6_cfg *cfg;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(*cfg);
@@ -442,7 +441,7 @@ nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, int sort)
 
 		cfg = (ipfw_nptv6_cfg *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
-			error = f(cfg, name, set);
+			(void)f(cfg, name, set);
 			cfg = (ipfw_nptv6_cfg *)((caddr_t)cfg + olh->objsize);
 		}
 		free(olh);
diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c
index 37cbd7a2d7ae..d4fc770d375e 100644
--- a/sbin/ipfw/tables.c
+++ b/sbin/ipfw/tables.c
@@ -1408,7 +1408,6 @@ guess_key_type(char *key, uint8_t *ptype)
 {
 	char *p;
 	struct in6_addr addr;
-	uint32_t kv;
 
 	if (ishexnumber(*key) != 0 || *key == ':') {
 		/* Remove / if exists */
@@ -1424,7 +1423,7 @@ guess_key_type(char *key, uint8_t *ptype)
 		} else {
 			/* Port or any other key */
 			/* Skip non-base 10 entries like 'fa1' */
-			kv = strtol(key, &p, 10);
+			(void)strtol(key, &p, 10);
 			if (*p == '\0') {
 				*ptype = IPFW_TABLE_NUMBER;
 				return (0);
@@ -1712,7 +1711,6 @@ tables_foreach(table_cb_t *f, void *arg, int sort)
 	ipfw_xtable_info *info;
 	size_t sz;
 	uint32_t i;
-	int error;
 
 	/* Start with reasonable default */
 	sz = sizeof(*olh) + 16 * sizeof(ipfw_xtable_info);
@@ -1737,7 +1735,7 @@ tables_foreach(table_cb_t *f, void *arg, int sort)
 		info = (ipfw_xtable_info *)(olh + 1);
 		for (i = 0; i < olh->count; i++) {
 			if (g_co.use_set == 0 || info->set == g_co.use_set - 1)
-				error = f(info, arg);
+				(void)f(info, arg);
 			info = (ipfw_xtable_info *)((caddr_t)info +
 			    olh->objsize);
 		}