git: a3522837b021 - main - ipfilter userland: Fix branch mismerge

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Tue, 04 Jan 2022 03:44:14 UTC
The branch main has been updated by cy:

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

commit a3522837b021a46f2de81303247599ea51163d13
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-01-04 03:04:04 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-01-04 03:39:24 +0000

    ipfilter userland: Fix branch mismerge
    
    The work to ANSIfy and adjust returns to style(9) resulted in a mismerge
    of a stash when ipfilter was moved from contrib to sbin. An older file
    replaced WIP at the time, resulting in a regression.
    
    The majority of this work was done in 2018 saved as git stashes within
    a git-svn tree and migrated to the git tree. The regression occurred
    when the various stashes were sequentially merged to create individual
    commits, following the ipfilter move to netpfil and sbin.
    
    Reported by:    jrtc27
    Fixes:          2582ae5740181e0d2bab10003d66ae91c9b56329
    Pointy hat to:  cy
    MFC after:      1 month
---
 sbin/ipf/ipf/ipfcomp.c | 71 +++++++++++++++++++-------------------------------
 1 file changed, 27 insertions(+), 44 deletions(-)

diff --git a/sbin/ipf/ipf/ipfcomp.c b/sbin/ipf/ipf/ipfcomp.c
index fc16f4adea2c..cf01838d7966 100644
--- a/sbin/ipf/ipf/ipfcomp.c
+++ b/sbin/ipf/ipf/ipfcomp.c
@@ -62,8 +62,8 @@ static	FILE	*cfile = NULL;
  * This is called once per filter rule being loaded to emit data structures
  * required.
  */
-void printc(fr)
-	frentry_t *fr;
+void
+printc(frentry_t *fr)
 {
 	u_long *ulp;
 	char *and;
@@ -162,9 +162,8 @@ void printc(fr)
 static frgroup_t *groups = NULL;
 
 
-static void addrule(fp, fr)
-	FILE *fp;
-	frentry_t *fr;
+static void
+addrule(FILE *fp, frentry_t *fr)
 {
 	frentry_t *f, **fpp;
 	frgroup_t *g;
@@ -243,8 +242,8 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n",
 }
 
 
-int intcmp(c1, c2)
-	const void *c1, *c2;
+int
+intcmp(const void *c1, const void *c2)
 {
 	const mc_t *i1 = (const mc_t *)c1, *i2 = (const mc_t *)c2;
 
@@ -255,18 +254,15 @@ int intcmp(c1, c2)
 }
 
 
-static void indent(fp, in)
-	FILE *fp;
-	int in;
+static void
+indent(FILE *fp, int in)
 {
 	for (; in; in--)
 		fputc('\t', fp);
 }
 
-static void printeq(fp, var, m, max, v)
-	FILE *fp;
-	char *var;
-	int m, max, v;
+static void
+printeq(FILE *fp, char *var, int m, int max, int v)
 {
 	if (m == max)
 		fprintf(fp, "%s == %#x) {\n", var, v);
@@ -280,10 +276,8 @@ static void printeq(fp, var, m, max, v)
  *             m - netmask
  *             v - required address
  */
-static void printipeq(fp, var, fl, m, v)
-	FILE *fp;
-	char *var;
-	int fl, m, v;
+static void
+printipeq(FILE *fp, char *var, int fl, int m, int v)
 {
 	if (m == 0xffffffff)
 		fprintf(fp, "%s ", var);
@@ -294,10 +288,8 @@ static void printipeq(fp, var, fl, m, v)
 }
 
 
-void emit(num, dir, v, fr)
-	int num, dir;
-	void *v;
-	frentry_t *fr;
+void
+emit(int num, int dir, void *v, frentry_t *fr)
 {
 	u_int incnt, outcnt;
 	frgroup_t *g;
@@ -346,9 +338,8 @@ void emit(num, dir, v, fr)
 }
 
 
-static void emitheader(grp, incount, outcount)
-	frgroup_t *grp;
-	u_int incount, outcount;
+static void
+emitheader(frgroup_t *grp, u_int incount, u_int outcount)
 {
 	static FILE *fph = NULL;
 	frgroup_t *g;
@@ -401,7 +392,8 @@ extern int ipfrule_remove_out_%s(void));\n",
 	}
 }
 
-static void emittail()
+static void
+emittail(void)
 {
 	frgroup_t *g;
 
@@ -438,12 +430,9 @@ int ipfrule_remove()\n\
 }
 
 
-static void emitGroup(num, dir, v, fr, group, incount, outcount)
-	int num, dir;
-	void *v;
-	frentry_t *fr;
-	char *group;
-	u_int incount, outcount;
+static void
+emitGroup(int num, int dir, void *v, frentry_t *fr, char *group,
+	u_int incount, u_int outcount)
 {
 	static FILE *fp = NULL;
 	static int header[2] = { 0, 0 };
@@ -956,8 +945,8 @@ static void emitGroup(num, dir, v, fr, group, incount, outcount)
 }
 
 
-void printC(dir)
-	int dir;
+void
+printC(int dir)
 {
 	static mc_t *m = NULL;
 	frgroup_t *g;
@@ -979,11 +968,8 @@ void printC(dir)
 /*
  * Now print out code to implement all of the rules.
  */
-static void printCgroup(dir, top, m, group)
-	int dir;
-	frentry_t *top;
-	mc_t *m;
-	char *group;
+static void
+printCgroup(int dir, frentry_t *top, mc_t *m, char *group)
 {
 	frentry_t *fr, *fr1;
 	int i, n, rn;
@@ -1229,11 +1215,8 @@ static void printCgroup(dir, top, m, group)
 	}
 }
 
-static void printhooks(fp, in, out, grp)
-	FILE *fp;
-	int in;
-	int out;
-	frgroup_t *grp;
+static void
+printhooks(FILE *fp, int in, int out, frgroup_t *grp)
 {
 	frentry_t *fr;
 	char *group;