From owner-p4-projects@FreeBSD.ORG Wed Jan 31 06:17:15 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1D54816A414; Wed, 31 Jan 2007 06:17:15 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BEBA616A40E for ; Wed, 31 Jan 2007 06:17:14 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id AE8BE13C4A5 for ; Wed, 31 Jan 2007 06:17:14 +0000 (UTC) (envelope-from csjp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0V6HENG023116 for ; Wed, 31 Jan 2007 06:17:14 GMT (envelope-from csjp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0V6HEhO023113 for perforce@freebsd.org; Wed, 31 Jan 2007 06:17:14 GMT (envelope-from csjp@freebsd.org) Date: Wed, 31 Jan 2007 06:17:14 GMT Message-Id: <200701310617.l0V6HEhO023113@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to csjp@freebsd.org using -f From: "Christian S.J. Peron" To: Perforce Change Reviews Cc: Subject: PERFORCE change 113747 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2007 06:17:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=113747 Change 113747 by csjp@csjp_rnd01 on 2007/01/31 06:16:43 - ANSI'fy this file - Remove some gratutious use of the register keyword - Other cosmetic nits Affected files ... .. //depot/projects/zcopybpf/src/sys/net/bpf_filter.c#2 edit Differences ... ==== //depot/projects/zcopybpf/src/sys/net/bpf_filter.c#2 (text+ko) ==== @@ -83,14 +83,11 @@ static u_int32_t m_xword(struct mbuf *m, bpf_u_int32 k, int *err); static u_int32_t -m_xword(m, k, err) - register struct mbuf *m; - register bpf_u_int32 k; - register int *err; +m_xword(struct mbuf *m, bpf_u_int32 k, int *err) { - register size_t len; - register u_char *cp, *np; - register struct mbuf *m0; + size_t len; + u_char *cp, *np; + struct mbuf *m0; len = m->m_len; while (k >= len) { @@ -111,21 +108,18 @@ *err = 0; np = mtod(m0, u_char *); switch (len - k) { - case 1: return ((u_int32_t)cp[0] << 24) | ((u_int32_t)np[0] << 16) | ((u_int32_t)np[1] << 8) | (u_int32_t)np[2]; - case 2: return ((u_int32_t)cp[0] << 24) | ((u_int32_t)cp[1] << 16) | ((u_int32_t)np[0] << 8) | (u_int32_t)np[1]; - default: return ((u_int32_t)cp[0] << 24) | @@ -135,18 +129,15 @@ } bad: *err = 1; - return 0; + return (0); } static u_int16_t -m_xhalf(m, k, err) - register struct mbuf *m; - register bpf_u_int32 k; - register int *err; +m_xhalf(struct mbuf *m, bpf_u_int32 k, int *err) { - register size_t len; - register u_char *cp; - register struct mbuf *m0; + size_t len; + u_char *cp; + struct mbuf *m0; len = m->m_len; while (k >= len) { @@ -159,16 +150,16 @@ cp = mtod(m, u_char *) + k; if (len - k >= 2) { *err = 0; - return EXTRACT_SHORT(cp); + return (EXTRACT_SHORT(cp)); } m0 = m->m_next; if (m0 == 0) goto bad; *err = 0; - return (cp[0] << 8) | mtod(m0, u_char *)[0]; + return ((cp[0] << 8) | mtod(m0, u_char *)[0]); bad: *err = 1; - return 0; + return (0); } #endif @@ -178,21 +169,17 @@ * buflen is the amount of data present */ u_int -bpf_filter(pc, p, wirelen, buflen) - register const struct bpf_insn *pc; - register u_char *p; - u_int wirelen; - register u_int buflen; +bpf_filter(const struct bpf_insn *pc, u_char *p, u_int wirelen, u_int buflen) { - register u_int32_t A = 0, X = 0; - register bpf_u_int32 k; + u_int32_t A = 0, X = 0; + bpf_u_int32 k; int32_t mem[BPF_MEMWORDS]; - if (pc == 0) + if (pc == NULL) /* * No filter means accept all. */ - return (u_int)-1; + return ((u_int)-1); --pc; while (1) { @@ -206,10 +193,10 @@ abort(); #endif case BPF_RET|BPF_K: - return (u_int)pc->k; + return ((u_int)pc->k); case BPF_RET|BPF_A: - return (u_int)A; + return ((u_int)A); case BPF_LD|BPF_W|BPF_ABS: k = pc->k; @@ -224,7 +211,7 @@ return 0; continue; #else - return 0; + return (0); #endif } #ifdef BPF_ALIGN @@ -256,7 +243,7 @@ k = pc->k; if (k >= buflen) { #ifdef _KERNEL - register struct mbuf *m; + struct mbuf *m; if (buflen != 0) return 0; @@ -287,13 +274,13 @@ int merr; if (buflen != 0) - return 0; + return (0); A = m_xword((struct mbuf *)p, k, &merr); if (merr != 0) - return 0; + return (0); continue; #else - return 0; + return (0); #endif } #ifdef BPF_ALIGN @@ -315,10 +302,10 @@ return 0; A = m_xhalf((struct mbuf *)p, k, &merr); if (merr != 0) - return 0; + return (0); continue; #else - return 0; + return (0); #endif } A = EXTRACT_SHORT(&p[k]); @@ -328,7 +315,7 @@ k = X + pc->k; if (pc->k >= buflen || X >= buflen - pc->k) { #ifdef _KERNEL - register struct mbuf *m; + struct mbuf *m; if (buflen != 0) return 0; @@ -337,7 +324,7 @@ A = mtod(m, u_char *)[k]; continue; #else - return 0; + return (0); #endif } A = p[k];