From 19fef81560be48509a81878548a6da7da6687cb4 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 5 Apr 2024 18:01:56 +0000 Subject: [PATCH] ANSI functions; ok tb --- lib/libpcap/bpf_image.c | 6 +- lib/libpcap/etherent.c | 11 +- lib/libpcap/gencode.c | 237 +++++++++++---------------------------- lib/libpcap/inet.c | 5 +- lib/libpcap/nametoaddr.c | 5 +- lib/libpcap/optimize.c | 145 ++++++++---------------- lib/libpcap/scanner.l | 11 +- 7 files changed, 122 insertions(+), 298 deletions(-) diff --git a/lib/libpcap/bpf_image.c b/lib/libpcap/bpf_image.c index cd56d07ef20..5ff446178d5 100644 --- a/lib/libpcap/bpf_image.c +++ b/lib/libpcap/bpf_image.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf_image.c,v 1.11 2020/08/03 03:29:58 dlg Exp $ */ +/* $OpenBSD: bpf_image.c,v 1.12 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1994, 1995, 1996 @@ -34,9 +34,7 @@ #endif char * -bpf_image(p, n) - const struct bpf_insn *p; - int n; +bpf_image(const struct bpf_insn *p, int n) { int v; char *fmt, *op; diff --git a/lib/libpcap/etherent.c b/lib/libpcap/etherent.c index 057ff1edb17..b45d99fb881 100644 --- a/lib/libpcap/etherent.c +++ b/lib/libpcap/etherent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: etherent.c,v 1.9 2015/11/17 21:39:23 mmcc Exp $ */ +/* $OpenBSD: etherent.c,v 1.10 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1990, 1993, 1994, 1995, 1996 @@ -40,8 +40,7 @@ static __inline int skip_line(FILE *); /* Hex digit to integer. */ static __inline int -xdtoi(c) - int c; +xdtoi(int c) { if (isdigit(c)) return c - '0'; @@ -52,8 +51,7 @@ xdtoi(c) } static __inline int -skip_space(f) - FILE *f; +skip_space(FILE *f) { int c; @@ -65,8 +63,7 @@ skip_space(f) } static __inline int -skip_line(f) - FILE *f; +skip_line(FILE *f) { int c; diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index e5f5d33423c..ed688a4ba04 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.64 2022/12/27 17:10:07 jmc Exp $ */ +/* $OpenBSD: gencode.c,v 1.65 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -220,8 +220,7 @@ freechunks(void) * A strdup whose allocations are freed after code generation is over. */ char * -sdup(s) - const char *s; +sdup(const char *s) { int n = strlen(s) + 1; char *cp = newchunk(n); @@ -231,8 +230,7 @@ sdup(s) } static __inline struct block * -new_block(code) - int code; +new_block(int code) { struct block *p; @@ -244,8 +242,7 @@ new_block(code) } static __inline struct slist * -new_stmt(code) - int code; +new_stmt(int code) { struct slist *p; @@ -256,8 +253,7 @@ new_stmt(code) } static struct block * -gen_retblk(v) - int v; +gen_retblk(int v) { struct block *b = new_block(BPF_RET|BPF_K); @@ -386,8 +382,7 @@ pcap_freecode(struct bpf_program *program) * in each block is already resolved. */ static void -backpatch(list, target) - struct block *list, *target; +backpatch(struct block *list, struct block *target) { struct block *next; @@ -408,8 +403,7 @@ backpatch(list, target) * which of jt and jf is the link. */ static void -merge(b0, b1) - struct block *b0, *b1; +merge(struct block *b0, struct block *b1) { struct block **p = &b0; @@ -422,8 +416,7 @@ merge(b0, b1) } void -finish_parse(p) - struct block *p; +finish_parse(struct block *p) { backpatch(p, gen_retblk(snaplen)); p->sense = !p->sense; @@ -448,8 +441,7 @@ finish_parse(p) } void -gen_and(b0, b1) - struct block *b0, *b1; +gen_and(struct block *b0, struct block *b1) { backpatch(b0, b1->head); b0->sense = !b0->sense; @@ -460,8 +452,7 @@ gen_and(b0, b1) } void -gen_or(b0, b1) - struct block *b0, *b1; +gen_or(struct block *b0, struct block *b1) { b0->sense = !b0->sense; backpatch(b0, b1->head); @@ -471,16 +462,13 @@ gen_or(b0, b1) } void -gen_not(b) - struct block *b; +gen_not(struct block *b) { b->sense = !b->sense; } static struct block * -gen_cmp(offset, size, v) - u_int offset, size; - bpf_int32 v; +gen_cmp(u_int offset, u_int size, bpf_int32 v) { struct slist *s; struct block *b; @@ -496,9 +484,7 @@ gen_cmp(offset, size, v) } static struct block * -gen_cmp_gt(offset, size, v) - u_int offset, size; - bpf_int32 v; +gen_cmp_gt(u_int offset, u_int size, bpf_int32 v) { struct slist *s; struct block *b; @@ -514,10 +500,7 @@ gen_cmp_gt(offset, size, v) } static struct block * -gen_mcmp(offset, size, v, mask) - u_int offset, size; - bpf_int32 v; - bpf_u_int32 mask; +gen_mcmp(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask) { struct block *b = gen_cmp(offset, size, v); struct slist *s; @@ -532,10 +515,7 @@ gen_mcmp(offset, size, v, mask) /* Like gen_mcmp with 'dynamic off_nl' added to the offset */ static struct block * -gen_mcmp_nl(offset, size, v, mask) - u_int offset, size; - bpf_int32 v; - bpf_u_int32 mask; +gen_mcmp_nl(u_int offset, u_int size, bpf_int32 v, bpf_u_int32 mask) { struct block *b = gen_cmp_nl(offset, size, v); struct slist *s; @@ -549,9 +529,7 @@ gen_mcmp_nl(offset, size, v, mask) } static struct block * -gen_bcmp(offset, size, v) - u_int offset, size; - const u_char *v; +gen_bcmp(u_int offset, u_int size, const u_char *v) { struct block *b, *tmp; @@ -645,9 +623,7 @@ nl2X_stmt(void) /* Like gen_cmp but adds the dynamic 'off_nl' to the offset */ static struct block * -gen_cmp_nl(offset, size, v) - u_int offset, size; - bpf_int32 v; +gen_cmp_nl(u_int offset, u_int size, bpf_int32 v) { struct slist *s, *tmp; struct block *b; @@ -669,8 +645,7 @@ gen_cmp_nl(offset, size, v) } static void -init_linktype(type) - int type; +init_linktype(int type) { linktype = type; init_code = NULL; @@ -806,8 +781,7 @@ init_linktype(type) } static struct block * -gen_uncond(rsense) - int rsense; +gen_uncond(int rsense) { struct block *b; struct slist *s; @@ -833,8 +807,7 @@ gen_false() } static struct block * -gen_linktype(proto) - int proto; +gen_linktype(int proto) { struct block *b0, *b1; @@ -956,11 +929,8 @@ gen_linktype(proto) } static struct block * -gen_hostop(addr, mask, dir, proto, src_off, dst_off) - bpf_u_int32 addr; - bpf_u_int32 mask; - int dir, proto; - u_int src_off, dst_off; +gen_hostop(bpf_u_int32 addr, bpf_u_int32 mask, int dir, int proto, + u_int src_off, u_int dst_off) { struct block *b0, *b1; u_int offset; @@ -1000,11 +970,8 @@ gen_hostop(addr, mask, dir, proto, src_off, dst_off) #ifdef INET6 static struct block * -gen_hostop6(addr, mask, dir, proto, src_off, dst_off) - struct in6_addr *addr; - struct in6_addr *mask; - int dir, proto; - u_int src_off, dst_off; +gen_hostop6(struct in6_addr *addr, struct in6_addr *mask, int dir, int proto, + u_int src_off, u_int dst_off) { struct block *b0, *b1; u_int offset; @@ -1054,9 +1021,7 @@ gen_hostop6(addr, mask, dir, proto, src_off, dst_off) #endif /*INET6*/ static struct block * -gen_ehostop(eaddr, dir) - const u_char *eaddr; - int dir; +gen_ehostop(const u_char *eaddr, int dir) { struct block *b0, *b1; @@ -1090,9 +1055,7 @@ gen_ehostop(eaddr, dir) * Like gen_ehostop, but for DLT_FDDI */ static struct block * -gen_fhostop(eaddr, dir) - const u_char *eaddr; - int dir; +gen_fhostop(const u_char *eaddr, int dir) { struct block *b0, *b1; @@ -1149,10 +1112,7 @@ gen_fhostop(eaddr, dir) * and not generate masking instructions if the mask is 0xFFFF. */ static struct block * -gen_dnhostop(addr, dir, base_off) - bpf_u_int32 addr; - int dir; - u_int base_off; +gen_dnhostop(bpf_u_int32 addr, int dir, u_int base_off) { struct block *b0, *b1, *b2, *tmp; u_int offset_lh; /* offset if long header is received */ @@ -1220,11 +1180,7 @@ gen_dnhostop(addr, dir, base_off) } static struct block * -gen_host(addr, mask, proto, dir) - bpf_u_int32 addr; - bpf_u_int32 mask; - int proto; - int dir; +gen_host(bpf_u_int32 addr, bpf_u_int32 mask, int proto, int dir) { struct block *b0, *b1; @@ -1312,11 +1268,7 @@ gen_host(addr, mask, proto, dir) #ifdef INET6 static struct block * -gen_host6(addr, mask, proto, dir) - struct in6_addr *addr; - struct in6_addr *mask; - int proto; - int dir; +gen_host6(struct in6_addr *addr, struct in6_addr *mask, int proto, int dir) { switch (proto) { @@ -1433,8 +1385,7 @@ gen_gateway(eaddr, alist, proto, dir) #endif /*INET6*/ struct block * -gen_proto_abbrev(proto) - int proto; +gen_proto_abbrev(int proto) { struct block *b0 = NULL, *b1; @@ -1648,9 +1599,7 @@ iphl_to_x(void) } static struct block * -gen_portatom(off, v) - int off; - bpf_int32 v; +gen_portatom(int off, bpf_int32 v) { struct slist *s, *tmp; struct block *b; @@ -1670,17 +1619,14 @@ gen_portatom(off, v) #ifdef INET6 static struct block * -gen_portatom6(off, v) - int off; - bpf_int32 v; +gen_portatom6(int off, bpf_int32 v) { return gen_cmp_nl(40 + off, BPF_H, v); } #endif/*INET6*/ struct block * -gen_portop(port, proto, dir) - int port, proto, dir; +gen_portop(int port, int proto, int dir) { struct block *b0, *b1, *tmp; @@ -1720,10 +1666,7 @@ gen_portop(port, proto, dir) } static struct block * -gen_port(port, ip_proto, dir) - int port; - int ip_proto; - int dir; +gen_port(int port, int ip_proto, int dir) { struct block *b0, *b1, *tmp; @@ -1751,8 +1694,7 @@ gen_port(port, ip_proto, dir) #ifdef INET6 struct block * -gen_portop6(port, proto, dir) - int port, proto, dir; +gen_portop6(int port, int proto, int dir) { struct block *b0, *b1, *tmp; @@ -1790,10 +1732,7 @@ gen_portop6(port, proto, dir) } static struct block * -gen_port6(port, ip_proto, dir) - int port; - int ip_proto; - int dir; +gen_port6(int port, int ip_proto, int dir) { struct block *b0, *b1, *tmp; @@ -1821,9 +1760,7 @@ gen_port6(port, ip_proto, dir) #endif /* INET6 */ static int -lookup_proto(name, proto) - const char *name; - int proto; +lookup_proto(const char *name, int proto) { int v; @@ -1854,10 +1791,7 @@ lookup_proto(name, proto) } static struct block * -gen_protochain(v, proto, dir) - int v; - int proto; - int dir; +gen_protochain(int v, int proto, int dir) { struct block *b0, *b; struct slist *s[100]; @@ -2151,10 +2085,7 @@ gen_protochain(v, proto, dir) } static struct block * -gen_proto(v, proto, dir) - int v; - int proto; - int dir; +gen_proto(int v, int proto, int dir) { struct block *b0, *b1; @@ -2273,9 +2204,7 @@ gen_proto(v, proto, dir) } struct block * -gen_scode(name, q) - const char *name; - struct qual q; +gen_scode(const char *name, struct qual q) { int proto = q.proto; int dir = q.dir; @@ -2479,10 +2408,7 @@ gen_scode(name, q) } struct block * -gen_mcode(s1, s2, masklen, q) - const char *s1, *s2; - int masklen; - struct qual q; +gen_mcode(const char *s1, const char *s2, int masklen, struct qual q) { int nlen, mlen; bpf_u_int32 n, m; @@ -2520,10 +2446,7 @@ gen_mcode(s1, s2, masklen, q) } struct block * -gen_ncode(s, v, q) - const char *s; - bpf_u_int32 v; - struct qual q; +gen_ncode(const char *s, bpf_u_int32 v, struct qual q) { bpf_u_int32 mask; int proto = q.proto; @@ -2606,10 +2529,7 @@ gen_ncode(s, v, q) #ifdef INET6 struct block * -gen_mcode6(s1, s2, masklen, q) - const char *s1, *s2; - int masklen; - struct qual q; +gen_mcode6(const char *s1, const char *s2, int masklen, struct qual q) { struct addrinfo *res; struct in6_addr *addr; @@ -2664,9 +2584,7 @@ gen_mcode6(s1, s2, masklen, q) #endif /*INET6*/ struct block * -gen_ecode(eaddr, q) - const u_char *eaddr; - struct qual q; +gen_ecode(const u_char *eaddr, struct qual q) { if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) { if (linktype == DLT_EN10MB) @@ -2682,8 +2600,7 @@ gen_ecode(eaddr, q) } void -sappend(s0, s1) - struct slist *s0, *s1; +sappend(struct slist *s0, struct slist *s1) { /* * This is definitely not the best way to do this, but the @@ -2695,8 +2612,7 @@ sappend(s0, s1) } static struct slist * -xfer_to_x(a) - struct arth *a; +xfer_to_x(struct arth *a) { struct slist *s; @@ -2706,8 +2622,7 @@ xfer_to_x(a) } static struct slist * -xfer_to_a(a) - struct arth *a; +xfer_to_a(struct arth *a) { struct slist *s; @@ -2717,10 +2632,7 @@ xfer_to_a(a) } struct arth * -gen_load(proto, index, size) - int proto; - struct arth *index; - int size; +gen_load(int proto, struct arth *index, int size) { struct slist *s, *tmp; struct block *b; @@ -2824,10 +2736,7 @@ gen_load(proto, index, size) } struct block * -gen_relation(code, a0, a1, reversed) - int code; - struct arth *a0, *a1; - int reversed; +gen_relation(int code, struct arth *a0, struct arth *a1, int reversed) { struct slist *s0, *s1, *s2; struct block *b, *tmp; @@ -2902,8 +2811,7 @@ gen_loadrnd() } struct arth * -gen_loadi(val) - int val; +gen_loadi(int val) { struct arth *a; struct slist *s; @@ -2924,8 +2832,7 @@ gen_loadi(val) } struct arth * -gen_neg(a) - struct arth *a; +gen_neg(struct arth *a) { struct slist *s; @@ -2942,9 +2849,7 @@ gen_neg(a) } struct arth * -gen_arth(code, a0, a1) - int code; - struct arth *a0, *a1; +gen_arth(int code, struct arth *a0, struct arth *a1) { struct slist *s0, *s1, *s2; @@ -2998,15 +2903,13 @@ alloc_reg() * be used later. */ static void -free_reg(n) - int n; +free_reg(int n) { regused[n] = 0; } static struct block * -gen_len(jmp, n) - int jmp, n; +gen_len(int jmp, int n) { struct slist *s; struct block *b; @@ -3020,15 +2923,13 @@ gen_len(jmp, n) } struct block * -gen_greater(n) - int n; +gen_greater(int n) { return gen_len(BPF_JGE, n); } struct block * -gen_less(n) - int n; +gen_less(int n) { struct block *b; @@ -3039,8 +2940,7 @@ gen_less(n) } struct block * -gen_byteop(op, idx, val) - int op, idx, val; +gen_byteop(int op, int idx, int val) { struct block *b; struct slist *s; @@ -3080,8 +2980,7 @@ gen_byteop(op, idx, val) } struct block * -gen_broadcast(proto) - int proto; +gen_broadcast(int proto) { bpf_u_int32 hostmask; struct block *b0, *b1, *b2; @@ -3122,8 +3021,7 @@ gen_broadcast(proto) } struct block * -gen_multicast(proto) - int proto; +gen_multicast(int proto) { struct block *b0, *b1; struct slist *s; @@ -3179,8 +3077,7 @@ gen_multicast(proto) * = 1 implies "outbound". */ struct block * -gen_inbound(dir) - int dir; +gen_inbound(int dir) { struct block *b0; @@ -3348,9 +3245,7 @@ gen_p80211_type(int type, int mask) } static struct block * -gen_ahostop(eaddr, dir) - const u_char *eaddr; - int dir; +gen_ahostop(const u_char *eaddr, int dir) { struct block *b0, *b1; @@ -3380,9 +3275,7 @@ gen_ahostop(eaddr, dir) } struct block * -gen_acode(eaddr, q) - const u_char *eaddr; - struct qual q; +gen_acode(const u_char *eaddr, struct qual q) { if ((q.addr == Q_HOST || q.addr == Q_DEFAULT) && q.proto == Q_LINK) { if (linktype == DLT_ARCNET) @@ -3393,8 +3286,7 @@ gen_acode(eaddr, q) } struct block * -gen_mpls(label) - int label; +gen_mpls(int label) { struct block *b0; @@ -3424,8 +3316,7 @@ gen_mpls(label) * support IEEE 802.1Q VLAN trunk over ethernet */ struct block * -gen_vlan(vlan_num) - int vlan_num; +gen_vlan(int vlan_num) { struct block *b0; diff --git a/lib/libpcap/inet.c b/lib/libpcap/inet.c index 2e4db700d0d..16fa7583609 100644 --- a/lib/libpcap/inet.c +++ b/lib/libpcap/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.26 2021/12/01 18:28:45 deraadt Exp $ */ +/* $OpenBSD: inet.c,v 1.27 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1994, 1995, 1996, 1997, 1998 @@ -109,8 +109,7 @@ pcap_freealldevs(pcap_if_t *alldevs) * lowest unit number is preferred; loopback is ignored. */ char * -pcap_lookupdev(errbuf) - char *errbuf; +pcap_lookupdev(char *errbuf) { #ifdef HAVE_IFADDRS_H struct ifaddrs *ifap, *ifa, *mp; diff --git a/lib/libpcap/nametoaddr.c b/lib/libpcap/nametoaddr.c index e7d0c79a11d..2189b06d325 100644 --- a/lib/libpcap/nametoaddr.c +++ b/lib/libpcap/nametoaddr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nametoaddr.c,v 1.24 2021/12/01 18:28:45 deraadt Exp $ */ +/* $OpenBSD: nametoaddr.c,v 1.25 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996 @@ -255,8 +255,7 @@ pcap_nametollc(const char *s) /* Hex digit to integer. */ static __inline int -xdtoi(c) - int c; +xdtoi(int c) { if (isdigit(c)) return c - '0'; diff --git a/lib/libpcap/optimize.c b/lib/libpcap/optimize.c index 9b3eceff3a2..873b41fcda8 100644 --- a/lib/libpcap/optimize.c +++ b/lib/libpcap/optimize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: optimize.c,v 1.21 2020/08/03 03:29:58 dlg Exp $ */ +/* $OpenBSD: optimize.c,v 1.22 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996 @@ -199,8 +199,7 @@ static uset all_edge_sets; #endif static void -find_levels_r(b) - struct block *b; +find_levels_r(struct block *b) { int level; @@ -228,8 +227,7 @@ find_levels_r(b) * with the 'link' field of the struct block. */ static void -find_levels(root) - struct block *root; +find_levels(struct block *root) { memset((char *)levels, 0, n_blocks * sizeof(*levels)); unMarkAll(); @@ -241,8 +239,7 @@ find_levels(root) * Assumes graph has been leveled. */ static void -find_dom(root) - struct block *root; +find_dom(struct block *root) { int i; struct block *b; @@ -272,8 +269,7 @@ find_dom(root) } static void -propedom(ep) - struct edge *ep; +propedom(struct edge *ep) { SET_INSERT(ep->edom, ep->id); if (ep->succ) { @@ -287,8 +283,7 @@ propedom(ep) * Assumes graph has been leveled and predecessors established. */ static void -find_edom(root) - struct block *root; +find_edom(struct block *root) { int i; uset x; @@ -317,8 +312,7 @@ find_edom(root) * Assumes graph has been leveled. */ static void -find_closure(root) - struct block *root; +find_closure(struct block *root) { int i; struct block *b; @@ -348,8 +342,7 @@ find_closure(root) * The implementation should probably change to an array access. */ static int -atomuse(s) - struct stmt *s; +atomuse(struct stmt *s) { int c = s->code; @@ -394,8 +387,7 @@ atomuse(s) * The implementation should probably change to an array access. */ static int -atomdef(s) - struct stmt *s; +atomdef(struct stmt *s) { if (s->code == NOP) return -1; @@ -420,8 +412,7 @@ atomdef(s) } static void -compute_local_ud(b) - struct block *b; +compute_local_ud(struct block *b) { struct slist *s; atomset def = 0, use = 0, kill = 0; @@ -464,8 +455,7 @@ compute_local_ud(b) * Assume graph is already leveled. */ static void -find_ud(root) - struct block *root; +find_ud(struct block *root) { int i, maxlevel; struct block *p; @@ -530,9 +520,7 @@ init_val() /* Because we really don't have an IR, this stuff is a little messy. */ static int -F(code, v0, v1) - int code; - int v0, v1; +F(int code, int v0, int v1) { u_int hash; int val; @@ -563,11 +551,7 @@ F(code, v0, v1) } static __inline void -vstore(s, valp, newval, alter) - struct stmt *s; - int *valp; - int newval; - int alter; +vstore(struct stmt *s, int *valp, int newval, int alter) { if (alter && *valp == newval) s->code = NOP; @@ -576,9 +560,7 @@ vstore(s, valp, newval, alter) } static void -fold_op(s, v0, v1) - struct stmt *s; - int v0, v1; +fold_op(struct stmt *s, int v0, int v1) { bpf_int32 a, b; @@ -633,8 +615,7 @@ fold_op(s, v0, v1) } static __inline struct slist * -this_op(s) - struct slist *s; +this_op(struct slist *s) { while (s != 0 && s->s.code == NOP) s = s->next; @@ -642,8 +623,7 @@ this_op(s) } static void -opt_not(b) - struct block *b; +opt_not(struct block *b) { struct block *tmp = JT(b); @@ -652,8 +632,7 @@ opt_not(b) } static void -opt_peep(b) - struct block *b; +opt_peep(struct block *b) { struct slist *s; struct slist *next, *last; @@ -861,10 +840,7 @@ opt_peep(b) * evaluation and code transformations weren't folded together. */ static void -opt_stmt(s, val, alter) - struct stmt *s; - int val[]; - int alter; +opt_stmt(struct stmt *s, int val[], int alter) { int op; int v; @@ -1048,9 +1024,7 @@ opt_stmt(s, val, alter) } static void -deadstmt(s, last) - struct stmt *s; - struct stmt *last[]; +deadstmt(struct stmt *s, struct stmt *last[]) { int atom; @@ -1074,8 +1048,7 @@ deadstmt(s, last) } static void -opt_deadstores(b) - struct block *b; +opt_deadstores(struct block *b) { struct slist *s; int atom; @@ -1095,9 +1068,7 @@ opt_deadstores(b) } static void -opt_blk(b, do_stmts) - struct block *b; - int do_stmts; +opt_blk(struct block *b, int do_stmts) { struct slist *s; struct edge *p; @@ -1168,8 +1139,7 @@ opt_blk(b, do_stmts) * from 'b'. */ static int -use_conflict(b, succ) - struct block *b, *succ; +use_conflict(struct block *b, struct block *succ) { int atom; atomset use = succ->out_use; @@ -1185,9 +1155,7 @@ use_conflict(b, succ) } static struct block * -fold_edge(child, ep) - struct block *child; - struct edge *ep; +fold_edge(struct block *child, struct edge *ep) { int sense; int aval0, aval1, oval0, oval1; @@ -1231,8 +1199,7 @@ fold_edge(child, ep) } static void -opt_j(ep) - struct edge *ep; +opt_j(struct edge *ep) { int i, k; struct block *target; @@ -1287,8 +1254,7 @@ opt_j(ep) static void -or_pullup(b) - struct block *b; +or_pullup(struct block *b) { int val, at_top; struct block *pull; @@ -1380,8 +1346,7 @@ or_pullup(b) } static void -and_pullup(b) - struct block *b; +and_pullup(struct block *b) { int val, at_top; struct block *pull; @@ -1472,9 +1437,7 @@ and_pullup(b) } static void -opt_blks(root, do_stmts) - struct block *root; - int do_stmts; +opt_blks(struct block *root, int do_stmts) { int i, maxlevel; struct block *p; @@ -1507,17 +1470,14 @@ opt_blks(root, do_stmts) } static __inline void -link_inedge(parent, child) - struct edge *parent; - struct block *child; +link_inedge(struct edge *parent, struct block *child) { parent->next = child->in_edges; child->in_edges = parent; } static void -find_inedges(root) - struct block *root; +find_inedges(struct block *root) { int i; struct block *b; @@ -1538,8 +1498,7 @@ find_inedges(root) } static void -opt_root(b) - struct block **b; +opt_root(struct block **b) { struct slist *tmp, *s; @@ -1563,9 +1522,7 @@ opt_root(b) } static void -opt_loop(root, do_stmts) - struct block *root; - int do_stmts; +opt_loop(struct block *root, int do_stmts) { #ifdef BDEBUG @@ -1592,8 +1549,7 @@ opt_loop(root, do_stmts) * Optimize the filter code in its dag representation. */ void -bpf_optimize(rootp) - struct block **rootp; +bpf_optimize(struct block **rootp) { struct block *root; @@ -1608,8 +1564,7 @@ bpf_optimize(rootp) } static void -make_marks(p) - struct block *p; +make_marks(struct block *p) { if (!isMarked(p)) { Mark(p); @@ -1625,8 +1580,7 @@ make_marks(p) * only for nodes that are alive. */ static void -mark_code(p) - struct block *p; +mark_code(struct block *p) { cur_mark += 1; make_marks(p); @@ -1637,8 +1591,7 @@ mark_code(p) * the accumulator. */ static int -eq_slist(x, y) - struct slist *x, *y; +eq_slist(struct slist *x, struct slist *y) { while (1) { while (x && x->s.code == NOP) @@ -1657,8 +1610,7 @@ eq_slist(x, y) } static __inline int -eq_blk(b0, b1) - struct block *b0, *b1; +eq_blk(struct block *b0, struct block *b1) { if (b0->s.code == b1->s.code && b0->s.k == b1->s.k && @@ -1669,8 +1621,7 @@ eq_blk(b0, b1) } static void -intern_blocks(root) - struct block *root; +intern_blocks(struct block *root) { struct block *p; int i, j; @@ -1728,8 +1679,7 @@ opt_cleanup() * Return the number of stmts in 's'. */ static int -slength(s) - struct slist *s; +slength(struct slist *s) { int n = 0; @@ -1744,8 +1694,7 @@ slength(s) * All nodes should be initially unmarked. */ static int -count_blocks(p) - struct block *p; +count_blocks(struct block *p) { if (p == 0 || isMarked(p)) return 0; @@ -1758,8 +1707,7 @@ count_blocks(p) * the basic blocks, and entering them into the 'blocks' array.` */ static void -number_blks_r(p) - struct block *p; +number_blks_r(struct block *p) { int n; @@ -1780,8 +1728,7 @@ number_blks_r(p) * The nodes should be unmarked before calling. */ static int -count_stmts(p) - struct block *p; +count_stmts(struct block *p) { int n; @@ -1798,8 +1745,7 @@ count_stmts(p) * from the total number of blocks and/or statements. */ static void -opt_init(root) - struct block *root; +opt_init(struct block *root) { bpf_u_int32 *p; int i, n, max_stmts; @@ -1927,8 +1873,7 @@ int bids[1000]; * properly. */ static int -convert_code_r(p) - struct block *p; +convert_code_r(struct block *p) { struct bpf_insn *dst; struct slist *src; @@ -2086,9 +2031,7 @@ filled: * BPF array representation. Set *lenp to the number of instructions. */ struct bpf_insn * -icode_to_fcode(root, lenp) - struct block *root; - int *lenp; +icode_to_fcode(struct block *root, int *lenp) { int n; struct bpf_insn *fp; diff --git a/lib/libpcap/scanner.l b/lib/libpcap/scanner.l index ffae10e1951..c1e991c5a44 100644 --- a/lib/libpcap/scanner.l +++ b/lib/libpcap/scanner.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scanner.l,v 1.28 2020/08/03 03:40:02 dlg Exp $ */ +/* $OpenBSD: scanner.l,v 1.29 2024/04/05 18:01:56 deraadt Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -317,8 +317,7 @@ tcp-urg { yylval.i = 0x20; return NUM; } } %% void -lex_init(buf) - const char *buf; +lex_init(const char *buf) { in_buffer = buf; yyrestart(NULL); @@ -336,8 +335,7 @@ yywrap() /* Hex digit to integer. */ static inline int -xdtoi(c) - int c; +xdtoi(int c) { if (isdigit(c)) return c - '0'; @@ -352,8 +350,7 @@ xdtoi(c) * preceding 0x or 0 and uses hex or octal instead of decimal. */ static int -stoi(s) - char *s; +stoi(char *s) { int base = 10; int n = 0; -- 2.20.1