git: 0957619bf5f0 - stable/13 - setkey(8): ansify parser
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 05 Jun 2023 08:35:57 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=0957619bf5f0933b572a726200dad96ac9ecb96e
commit 0957619bf5f0933b572a726200dad96ac9ecb96e
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-04-03 02:00:25 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-06-05 08:35:00 +0000
setkey(8): ansify parser
(cherry picked from commit bef81bc0aef9dd4cd772b292d81bcc0ff7151d9f)
---
sbin/setkey/parse.y | 51 +++++++++++++--------------------------------------
sbin/setkey/token.l | 9 +++------
2 files changed, 16 insertions(+), 44 deletions(-)
diff --git a/sbin/setkey/parse.y b/sbin/setkey/parse.y
index 0d8605c3409a..3d3ed123d4f0 100644
--- a/sbin/setkey/parse.y
+++ b/sbin/setkey/parse.y
@@ -773,11 +773,7 @@ policy_requests
%%
int
-setkeymsg0(msg, type, satype, l)
- struct sadb_msg *msg;
- unsigned int type;
- unsigned int satype;
- size_t l;
+setkeymsg0(struct sadb_msg *msg, unsigned type, unsigned satype, size_t l)
{
msg->sadb_msg_version = PF_KEY_V2;
@@ -793,14 +789,8 @@ setkeymsg0(msg, type, satype, l)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
- unsigned int type;
- unsigned int upper;
- vchar_t *policy;
- struct addrinfo *srcs;
- int splen;
- struct addrinfo *dsts;
- int dplen;
+setkeymsg_spdaddr(unsigned type, unsigned upper, vchar_t *policy,
+ struct addrinfo *srcs, int splen, struct addrinfo *dsts, int dplen)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -892,12 +882,8 @@ setkeymsg_spdaddr(type, upper, policy, srcs, splen, dsts, dplen)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_addr(type, satype, srcs, dsts, no_spi)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
- int no_spi;
+setkeymsg_addr(unsigned type, unsigned satype, struct addrinfo *srcs,
+ struct addrinfo *dsts, int no_spi)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -1023,11 +1009,8 @@ setkeymsg_addr(type, satype, srcs, dsts, no_spi)
/* XXX NO BUFFER OVERRUN CHECK! BAD BAD! */
static int
-setkeymsg_add(type, satype, srcs, dsts)
- unsigned int type;
- unsigned int satype;
- struct addrinfo *srcs;
- struct addrinfo *dsts;
+setkeymsg_add(unsigned type, unsigned satype, struct addrinfo *srcs,
+ struct addrinfo *dsts)
{
struct sadb_msg *msg;
char buf[BUFSIZ];
@@ -1211,9 +1194,7 @@ setkeymsg_add(type, satype, srcs, dsts)
}
static struct addrinfo *
-parse_addr(host, port)
- char *host;
- char *port;
+parse_addr(char *host, char *port)
{
struct addrinfo hints, *res = NULL;
int error;
@@ -1232,8 +1213,7 @@ parse_addr(host, port)
}
static int
-fix_portstr(spec, sport, dport)
- vchar_t *spec, *sport, *dport;
+fix_portstr(vchar_t *spec, vchar_t *sport, vchar_t *dport)
{
char *p, *p2;
u_int l;
@@ -1273,13 +1253,8 @@ fix_portstr(spec, sport, dport)
}
static int
-setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
- char *buf;
- int *off;
- struct sadb_ext *ebuf;
- int elen;
- caddr_t vbuf;
- int vlen;
+setvarbuf(char *buf, int *off, struct sadb_ext *ebuf, int elen, caddr_t vbuf,
+ int vlen)
{
memset(buf + *off, 0, PFKEY_UNUNIT64(ebuf->sadb_ext_len));
memcpy(buf + *off, (caddr_t)ebuf, elen);
@@ -1290,7 +1265,7 @@ setvarbuf(buf, off, ebuf, elen, vbuf, vlen)
}
void
-parse_init()
+parse_init(void)
{
p_spi = 0;
@@ -1309,7 +1284,7 @@ parse_init()
}
void
-free_buffer()
+free_buffer(void)
{
/* we got tons of memory leaks in the parser anyways, leave them */
}
diff --git a/sbin/setkey/token.l b/sbin/setkey/token.l
index 9a0cc9ea1915..180493d76b05 100644
--- a/sbin/setkey/token.l
+++ b/sbin/setkey/token.l
@@ -251,23 +251,20 @@ any { return(ANY); }
%%
void
-yyfatal(s)
- const char *s;
+yyfatal(const char *s)
{
yyerror(s);
exit(1);
}
void
-yyerror(s)
- const char *s;
+yyerror(const char *s)
{
printf("line %d: %s at [%s]\n", lineno, s, yytext);
}
int
-parse(fp)
- FILE **fp;
+parse(FILE **fp)
{
yyin = *fp;