From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 20:36:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE841065672 for ; Tue, 27 Jan 2009 20:36:44 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id AED078FC19 for ; Tue, 27 Jan 2009 20:36:43 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-034-230.pools.arcor-ip.net [88.66.34.230]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1LRufq0XeI-0003S2; Tue, 27 Jan 2009 21:36:42 +0100 Received: (qmail 51468 invoked from network); 27 Jan 2009 20:36:39 -0000 Received: from fbsd8.laiers.local (192.168.4.200) by mx.laiers.local with SMTP; 27 Jan 2009 20:36:39 -0000 From: Max Laier Organization: FreeBSD To: Luigi Rizzo Date: Tue, 27 Jan 2009 21:36:38 +0100 User-Agent: KMail/1.10.4 (FreeBSD/8.0-CURRENT; KDE/4.1.4; i386; ; ) References: <200901272026.n0RKQjq3095984@svn.freebsd.org> In-Reply-To: <200901272026.n0RKQjq3095984@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901272136.39409.max@love2party.net> X-Provags-ID: V01U2FsdGVkX18u+zCG1aW1KmWtMjxppj50olGz9eWTqlhyC3u cEAXjLub66wccfWJwB74P+bt+uNYp4tL9wXsaxAnxzVn6L3Sda BnTntODlpNBQ0WqjlmoEA== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187787 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 20:36:44 -0000 On Tuesday 27 January 2009 21:26:45 Luigi Rizzo wrote: > Author: luigi > Date: Tue Jan 27 20:26:45 2009 > New Revision: 187787 > URL: http://svn.freebsd.org/changeset/base/187787 > > Log: > fix printing of uint64_t values, so we can use WARNS=2 ... > Modified: head/sbin/ipfw/ipfw2.c > =========================================================================== > --- head/sbin/ipfw/ipfw2.c Tue Jan 27 20:25:55 2009 (r187786) > +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 20:26:45 2009 (r187787) > @@ -306,8 +306,18 @@ static struct _s_x rule_options[] = { > { NULL, 0 } /* terminator */ > }; > > -static __inline uint64_t > -align_uint64(uint64_t *pll) { > +/* > + * The following is used to generate a printable argument for > + * 64-bit numbers, irrespective of platform alignment and bit size. > + * Because all the printf in this program use %llu as a format, > + * we just return an unsigned long long, which is larger than > + * we need in certain cases, but saves the hassle of using > + * PRIu64 as a format specifier. > + * We don't care about inlining, this is not performance critical code. > + */ You can always use uintmax_t and print with %ju instead. I'm also not sure that you really need this. None of the structures that hold the 64bit values are packed and thus should be correctly aligned. A simple cast to uintmax_t should be sufficient. > +unsigned long long > +align_uint64(const uint64_t *pll) > +{ > uint64_t ret; > > bcopy (pll, &ret, sizeof(ret)); -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News