From owner-svn-src-user@FreeBSD.ORG Tue Dec 29 18:54:39 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DA61106568D; Tue, 29 Dec 2009 18:54:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3888FC2E; Tue, 29 Dec 2009 18:54:39 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AFFF646B4C; Tue, 29 Dec 2009 13:54:38 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id D63808A01B; Tue, 29 Dec 2009 13:54:37 -0500 (EST) From: John Baldwin To: Luigi Rizzo Date: Tue, 29 Dec 2009 07:46:58 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.2-CBSD-20091103; KDE/4.3.1; amd64; ; ) References: <200912272213.nBRMDJAC069043@svn.freebsd.org> <20091229021846.U46429@delplex.bde.org> <20091228232151.GA39294@onelab2.iet.unipi.it> In-Reply-To: <20091228232151.GA39294@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200912290746.59011.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 29 Dec 2009 13:54:37 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.0 required=4.2 tests=AWL,BAYES_00, DATE_IN_PAST_06_12,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Luigi Rizzo , src-committers@freebsd.org, Bruce Evans , svn-src-user@freebsd.org Subject: Re: svn commit: r201063 - user/luigi/ipfw3-head/sys/netinet/ipfw X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 18:54:39 -0000 On Monday 28 December 2009 6:21:51 pm Luigi Rizzo wrote: > On Tue, Dec 29, 2009 at 02:38:15AM +1100, Bruce Evans wrote: > > On Sun, 27 Dec 2009, Luigi Rizzo wrote: > > > > >Log: > > > use a less obfuscated construct to call the hook/unhook functions > > > > > >Modified: > > > user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > > > > Better unobfuscation: > > > > >Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c > > >============================================================================== > > >--- user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > > >21:58:48 2009 (r201062) > > >+++ user/luigi/ipfw3-head/sys/netinet/ipfw/ip_fw_pfil.c Sun Dec 27 > > >22:13:19 2009 (r201063) > > >@@ -329,18 +329,17 @@ ipfw_divert(struct mbuf **m0, int incomi > > >static int > > >ipfw_hook(int onoff, int pf) > > >{ > > >+ const int arg = PFIL_IN | PFIL_OUT | PFIL_WAITOK; > > > > Don't add this obfuscation (a constant used only once stored in a variable > > used only once, just to avoid 2 long lines (1 after my change). > > It is not just that. > > I want to tell humans reading the code that the value used in the > two calls is exactly the same, beyond any chance of misspelling or > misreading the two long lines. > > Then whether or not to store it in a variable is compiler's business, > same as if i use the constant FOO ( #define FOO 0x11122334455667788LL ) > 20 times in a piece of code. Bruce's cute ?: trick for picking which function pointer to invoke avoided that problem FWIW as the flags were only passed once. -- John Baldwin