git: 58436df347de - main - libipsec: ansify

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 16 Mar 2023 19:19:46 UTC
The branch main has been updated by mjg:

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

commit 58436df347de665f6bc635a0e3018fc6f3d0a656
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2023-03-16 19:19:35 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2023-03-16 19:19:35 +0000

    libipsec: ansify
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 lib/libipsec/ipsec_dump_policy.c   | 22 +++++-----------------
 lib/libipsec/ipsec_get_policylen.c |  3 +--
 lib/libipsec/policy_parse.y        | 26 +++++++++-----------------
 lib/libipsec/policy_token.l        |  5 ++---
 4 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/lib/libipsec/ipsec_dump_policy.c b/lib/libipsec/ipsec_dump_policy.c
index 76848f3cb0a5..46c370f4f158 100644
--- a/lib/libipsec/ipsec_dump_policy.c
+++ b/lib/libipsec/ipsec_dump_policy.c
@@ -70,9 +70,7 @@ static char *set_address(char *, size_t, struct sockaddr *);
  * When delimiter == NULL, alternatively ' '(space) is applied.
  */
 char *
-ipsec_dump_policy(policy, delimiter)
-	caddr_t policy;
-	char *delimiter;
+ipsec_dump_policy(caddr_t policy, char *delimiter)
 {
 	struct sadb_x_policy *xpl = (struct sadb_x_policy *)policy;
 	struct sadb_x_ipsecrequest *xisr;
@@ -175,11 +173,8 @@ ipsec_dump_policy(policy, delimiter)
 }
 
 static char *
-ipsec_dump_ipsecrequest(buf, len, xisr, bound)
-	char *buf;
-	size_t len;
-	struct sadb_x_ipsecrequest *xisr;
-	size_t bound;	/* boundary */
+ipsec_dump_ipsecrequest(char *buf, size_t len, struct sadb_x_ipsecrequest *xisr,
+    size_t bound)
 {
 	const char *proto, *mode, *level;
 	char abuf[NI_MAXHOST * 2 + 2];
@@ -276,11 +271,7 @@ ipsec_dump_ipsecrequest(buf, len, xisr, bound)
 }
 
 static int
-set_addresses(buf, len, sa1, sa2)
-	char *buf;
-	size_t len;
-	struct sockaddr *sa1;
-	struct sockaddr *sa2;
+set_addresses(char *buf, size_t len, struct sockaddr *sa1, struct sockaddr *sa2)
 {
 	char tmp1[NI_MAXHOST], tmp2[NI_MAXHOST];
 
@@ -294,10 +285,7 @@ set_addresses(buf, len, sa1, sa2)
 }
 
 static char *
-set_address(buf, len, sa)
-	char *buf;
-	size_t len;
-	struct sockaddr *sa;
+set_address(char *buf, size_t len, struct sockaddr *sa)
 {
 	const int niflags = NI_NUMERICHOST;
 
diff --git a/lib/libipsec/ipsec_get_policylen.c b/lib/libipsec/ipsec_get_policylen.c
index 37e02778ef51..04f6e3abba94 100644
--- a/lib/libipsec/ipsec_get_policylen.c
+++ b/lib/libipsec/ipsec_get_policylen.c
@@ -44,8 +44,7 @@ __FBSDID("$FreeBSD$");
 #include "ipsec_strerror.h"
 
 int
-ipsec_get_policylen(policy)
-	caddr_t policy;
+ipsec_get_policylen(caddr_t policy)
 {
 	return policy ? PFKEY_EXTLEN(policy) : -1;
 }
diff --git a/lib/libipsec/policy_parse.y b/lib/libipsec/policy_parse.y
index a9c45804ab0d..ca9c8d0431d2 100644
--- a/lib/libipsec/policy_parse.y
+++ b/lib/libipsec/policy_parse.y
@@ -213,8 +213,7 @@ addresses
 %%
 
 void
-yyerror(msg)
-	char *msg;
+yyerror(char *msg)
 {
 	fprintf(stderr, "libipsec: %s while parsing \"%s\"\n",
 		msg, __libipsecyytext);
@@ -223,8 +222,7 @@ yyerror(msg)
 }
 
 static struct sockaddr *
-parse_sockaddr(buf)
-	struct _val *buf;
+parse_sockaddr(struct _val *buf)
 {
 	struct addrinfo hints, *res;
 	char *serv = NULL;
@@ -262,7 +260,7 @@ parse_sockaddr(buf)
 }
 
 static int
-rule_check()
+rule_check(void)
 {
 	if (p_type == IPSEC_POLICY_IPSEC) {
 		if (p_protocol == IPPROTO_IP) {
@@ -293,7 +291,7 @@ rule_check()
 }
 
 static int
-init_x_policy()
+init_x_policy(void)
 {
 	struct sadb_x_policy *p;
 
@@ -319,8 +317,7 @@ init_x_policy()
 }
 
 static int
-set_x_request(src, dst)
-	struct sockaddr *src, *dst;
+set_x_request(struct sockaddr *src, struct sockaddr *dst)
 {
 	struct sadb_x_ipsecrequest *p;
 	int reqlen;
@@ -351,8 +348,7 @@ set_x_request(src, dst)
 }
 
 static int
-set_sockaddr(addr)
-	struct sockaddr *addr;
+set_sockaddr(struct sockaddr *addr)
 {
 	if (addr == NULL) {
 		__ipsec_errcode = EIPSEC_NO_ERROR;
@@ -370,7 +366,7 @@ set_sockaddr(addr)
 }
 
 static void
-policy_parse_request_init()
+policy_parse_request_init(void)
 {
 	p_protocol = IPPROTO_IP;
 	p_mode = IPSEC_MODE_ANY;
@@ -389,9 +385,7 @@ policy_parse_request_init()
 }
 
 static caddr_t
-policy_parse(msg, msglen)
-	char *msg;
-	int msglen;
+policy_parse(char *msg, int msglen)
 {
 	int error;
 	pbuf = NULL;
@@ -421,9 +415,7 @@ policy_parse(msg, msglen)
 }
 
 caddr_t
-ipsec_set_policy(msg, msglen)
-	char *msg;
-	int msglen;
+ipsec_set_policy(char *msg, int msglen)
 {
 	caddr_t policy;
 
diff --git a/lib/libipsec/policy_token.l b/lib/libipsec/policy_token.l
index 81893912714d..c5e4d4765a5f 100644
--- a/lib/libipsec/policy_token.l
+++ b/lib/libipsec/policy_token.l
@@ -138,8 +138,7 @@ void __policy__strbuffer__free__(void);
 static YY_BUFFER_STATE strbuffer;
 
 void
-__policy__strbuffer__init__(msg)
-	char *msg;
+__policy__strbuffer__init__(char *msg)
 {
 	if (YY_CURRENT_BUFFER)
 		yy_delete_buffer(YY_CURRENT_BUFFER);
@@ -150,7 +149,7 @@ __policy__strbuffer__init__(msg)
 }
 
 void
-__policy__strbuffer__free__()
+__policy__strbuffer__free__(void)
 {
 	yy_delete_buffer(strbuffer);