svn commit: r187787 - head/sbin/ipfw
Max Laier
max at love2party.net
Tue Jan 27 12:36:44 PST 2009
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 at freebsd.org
\ / Max Laier | ICQ #67774661
X http://pf4freebsd.love2party.net/ | mlaier at EFnet
/ \ ASCII Ribbon Campaign | Against HTML Mail and News
More information about the svn-src-head
mailing list