summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-09-19 15:17:04 +0200
committerFlorian Westphal <fw@strlen.de>2018-09-24 11:49:57 +0200
commit7e50ebabbf9c3a5eeb9511d9f32c6104b56da5cd (patch)
tree8096c2c282213fa2bdb6c9da6df58f4fa0e72608
parentf40ce2d853591220f16c0851bf8665e6967af1f1 (diff)
Fix a few cases of pointless assignments
This gets rid of a number of assignments which are either redundant or not used afterwards. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r--iptables/ip6tables-restore.c4
-rw-r--r--iptables/iptables-restore.c4
-rw-r--r--iptables/iptables-xml.c4
-rw-r--r--iptables/nft.c2
-rw-r--r--iptables/xtables-eb-translate.c1
-rw-r--r--iptables/xtables-eb.c3
-rw-r--r--iptables/xtables-restore.c4
-rw-r--r--libxtables/xtoptions.c2
-rw-r--r--utils/nfnl_osf.c13
9 files changed, 14 insertions, 23 deletions
diff --git a/iptables/ip6tables-restore.c b/iptables/ip6tables-restore.c
index 2bb303ac..3706b981 100644
--- a/iptables/ip6tables-restore.c
+++ b/iptables/ip6tables-restore.c
@@ -316,14 +316,14 @@ int ip6tables_restore_main(int argc, char *argv[])
} else if (in_table) {
int a;
- char *ptr = buffer;
char *pcnt = NULL;
char *bcnt = NULL;
char *parsestart;
if (buffer[0] == '[') {
/* we have counters in our input */
- ptr = strchr(buffer, ']');
+ char *ptr = strchr(buffer, ']');
+
if (!ptr)
xtables_error(PARAMETER_PROBLEM,
"Bad line %u: need ]\n",
diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c
index 5c211d07..daee5fd9 100644
--- a/iptables/iptables-restore.c
+++ b/iptables/iptables-restore.c
@@ -314,14 +314,14 @@ iptables_restore_main(int argc, char *argv[])
} else if (in_table) {
int a;
- char *ptr = buffer;
char *pcnt = NULL;
char *bcnt = NULL;
char *parsestart;
if (buffer[0] == '[') {
/* we have counters in our input */
- ptr = strchr(buffer, ']');
+ char *ptr = strchr(buffer, ']');
+
if (!ptr)
xtables_error(PARAMETER_PROBLEM,
"Bad line %u: need ]\n",
diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c
index 788a67c6..07300efc 100644
--- a/iptables/iptables-xml.c
+++ b/iptables/iptables-xml.c
@@ -648,7 +648,6 @@ iptables_xml_main(int argc, char *argv[])
ret = 1;
} else if (curTable[0]) {
unsigned int a;
- char *ptr = buffer;
char *pcnt = NULL;
char *bcnt = NULL;
char *parsestart;
@@ -661,7 +660,8 @@ iptables_xml_main(int argc, char *argv[])
if (buffer[0] == '[') {
/* we have counters in our input */
- ptr = strchr(buffer, ']');
+ char *ptr = strchr(buffer, ']');
+
if (!ptr)
xtables_error(PARAMETER_PROBLEM,
"Bad line %u: need ]\n",
diff --git a/iptables/nft.c b/iptables/nft.c
index 032c3788..b81f41ab 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2169,8 +2169,6 @@ int nft_rule_delete_num(struct nft_handle *h, const char *chain,
r = nft_rule_find(h, list, chain, table, NULL, rulenum);
if (r != NULL) {
- ret = 1;
-
DEBUGP("deleting rule by number %d\n", rulenum);
ret = __nft_rule_del(h, list, r);
if (ret < 0)
diff --git a/iptables/xtables-eb-translate.c b/iptables/xtables-eb-translate.c
index fb37b56e..07d61776 100644
--- a/iptables/xtables-eb-translate.c
+++ b/iptables/xtables-eb-translate.c
@@ -332,7 +332,6 @@ print_zero:
if (OPT_COMMANDS)
xtables_error(PARAMETER_PROBLEM,
"Multiple commands are not allowed");
- command = 'V';
if (exec_style == EXEC_STYLE_DAEMON)
xtables_error(PARAMETER_PROBLEM,
"%s %s\n", prog_name, prog_vers);
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index 6aa1cba3..84d554e9 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -817,7 +817,6 @@ int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table,
{
char *buffer;
int c, i;
- int zerochain = -1; /* Needed for the -Z option (we can have -Z <this> -L <that>) */
int chcounter = 0; /* Needed for -C */
int rule_nr = 0;
int rule_nr_end = 0;
@@ -968,7 +967,6 @@ print_zero:
if (OPT_COMMANDS)
xtables_error(PARAMETER_PROBLEM,
"Multiple commands are not allowed");
- command = 'V';
printf("%s %s (nf_tables)\n", prog_name, prog_vers);
exit(0);
case 'h': /* Help */
@@ -1303,7 +1301,6 @@ print_zero:
flags&LIST_C);
}
if (flags & OPT_ZERO) {
- selected_chain = zerochain;
ret = nft_chain_zero_counters(h, chain, *table, 0);
} else if (command == 'F') {
ret = nft_rule_flush(h, chain, *table, 0);
diff --git a/iptables/xtables-restore.c b/iptables/xtables-restore.c
index 9d15593f..d9faa4d0 100644
--- a/iptables/xtables-restore.c
+++ b/iptables/xtables-restore.c
@@ -266,7 +266,6 @@ void xtables_restore_parse(struct nft_handle *h,
} else if (in_table) {
int a;
- char *ptr = buffer;
char *pcnt = NULL;
char *bcnt = NULL;
char *parsestart;
@@ -276,7 +275,8 @@ void xtables_restore_parse(struct nft_handle *h,
if (buffer[0] == '[') {
/* we have counters in our input */
- ptr = strchr(buffer, ']');
+ char *ptr = strchr(buffer, ']');
+
if (!ptr)
xtables_error(PARAMETER_PROBLEM,
"Bad line %u: need ]\n",
diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
index 05887a05..d329f2ff 100644
--- a/libxtables/xtoptions.c
+++ b/libxtables/xtoptions.c
@@ -286,7 +286,7 @@ static void xtopt_mint_value_to_ptr(struct xt_option_call *cb, void **datap,
static void xtopt_parse_mint(struct xt_option_call *cb)
{
const struct xt_option_entry *entry = cb->entry;
- const char *arg = cb->arg;
+ const char *arg;
size_t esize = xtopt_esize_by_type(entry->type);
const uintmax_t lmax = xtopt_max_by_type(entry->type);
void *put = XTOPT_MKPTR(cb);
diff --git a/utils/nfnl_osf.c b/utils/nfnl_osf.c
index fad7f700..0ea33fce 100644
--- a/utils/nfnl_osf.c
+++ b/utils/nfnl_osf.c
@@ -157,7 +157,6 @@ static void xt_osf_parse_opt(struct xt_osf_opt *opt, __u16 *optnum, char *obuf,
i = 0;
while (ptr != NULL && i < olen && *ptr != 0) {
val = 0;
- op = 0;
wc = OSF_WSS_PLAIN;
switch (obuf[i]) {
case 'N':
@@ -344,7 +343,7 @@ static int osf_load_line(char *buffer, int len, int del)
pend = xt_osf_strchr(pbeg, OSFPDEL);
if (pend) {
*pend = '\0';
- cnt = snprintf(obuf, sizeof(obuf), "%s,", pbeg);
+ snprintf(obuf, sizeof(obuf), "%s,", pbeg);
pbeg = pend + 1;
}
@@ -352,25 +351,23 @@ static int osf_load_line(char *buffer, int len, int del)
if (pend) {
*pend = '\0';
if (pbeg[0] == '@' || pbeg[0] == '*')
- cnt = snprintf(f.genre, sizeof(f.genre), "%s", pbeg + 1);
+ snprintf(f.genre, sizeof(f.genre), "%s", pbeg + 1);
else
- cnt = snprintf(f.genre, sizeof(f.genre), "%s", pbeg);
+ snprintf(f.genre, sizeof(f.genre), "%s", pbeg);
pbeg = pend + 1;
}
pend = xt_osf_strchr(pbeg, OSFPDEL);
if (pend) {
*pend = '\0';
- cnt = snprintf(f.version, sizeof(f.version), "%s", pbeg);
+ snprintf(f.version, sizeof(f.version), "%s", pbeg);
pbeg = pend + 1;
}
pend = xt_osf_strchr(pbeg, OSFPDEL);
if (pend) {
*pend = '\0';
- cnt =
- snprintf(f.subtype, sizeof(f.subtype), "%s", pbeg);
- pbeg = pend + 1;
+ snprintf(f.subtype, sizeof(f.subtype), "%s", pbeg);
}
xt_osf_parse_opt(f.opt, &f.opt_num, obuf, sizeof(obuf));