aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-04-09 00:25:13 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-04-09 00:25:13 +0000
commitd557e89abb43c8fadf490a1a5919e9dd184eeaf9 (patch)
treea82bfb33c9b84f6d152730b1a581201760357caf
parent834533b9c50e5943bd34801677bdb0fe52619ad5 (diff)
downloadsrc-d557e89abb43c8fadf490a1a5919e9dd184eeaf9.tar.gz
src-d557e89abb43c8fadf490a1a5919e9dd184eeaf9.zip
pf: Workaround set but unused warning.
The RB_NEXT macro does not use its middle argument since commit 5fce408cc44c737267aaaf0dcecd3454ba9089cd in 2004 (which ironically fixed an "unused parameter" warning by introducing this warning in all consumers). RB_PREV has also copied this unfortunate behavior of an unused argument. This results in 'parent' not being used. To workaround, inline the value of 'parent' as the second argument to RB_NEXT. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D34833
-rw-r--r--sys/netpfil/pf/pf.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 027d48c82688..a150c7e86e5e 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -3371,13 +3371,10 @@ pf_step_out_of_anchor(struct pf_kanchor_stackframe *stack, int *depth,
f = stack + *depth - 1;
fr = PF_ANCHOR_RULE(f);
if (f->child != NULL) {
- struct pf_kanchor_node *parent;
-
/*
* This block traverses through
* a wildcard anchor.
*/
- parent = &fr->anchor->children;
if (match != NULL && *match) {
/*
* If any of "*" matched, then
@@ -3387,7 +3384,8 @@ pf_step_out_of_anchor(struct pf_kanchor_stackframe *stack, int *depth,
PF_ANCHOR_SET_MATCH(f);
*match = 0;
}
- f->child = RB_NEXT(pf_kanchor_node, parent, f->child);
+ f->child = RB_NEXT(pf_kanchor_node,
+ &fr->anchor->children, f->child);
if (f->child != NULL) {
*rs = &f->child->ruleset;
*r = TAILQ_FIRST((*rs)->rules[n].active.ptr);
@@ -3475,12 +3473,10 @@ pf_step_out_of_keth_anchor(struct pf_keth_anchor_stackframe *stack, int *depth,
f = stack + *depth - 1;
fr = PF_ETH_ANCHOR_RULE(f);
if (f->child != NULL) {
- struct pf_keth_anchor_node *parent;
/*
* This block traverses through
* a wildcard anchor.
*/
- parent = &fr->anchor->children;
if (match != NULL && *match) {
/*
* If any of "*" matched, then
@@ -3490,8 +3486,8 @@ pf_step_out_of_keth_anchor(struct pf_keth_anchor_stackframe *stack, int *depth,
PF_ETH_ANCHOR_SET_MATCH(f);
*match = 0;
}
- f->child = RB_NEXT(pf_keth_anchor_node, parent,
- f->child);
+ f->child = RB_NEXT(pf_keth_anchor_node,
+ &fr->anchor->children, f->child);
if (f->child != NULL) {
*rs = &f->child->ruleset;
*r = TAILQ_FIRST((*rs)->active.rules);