Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jun 2010 12:20:26 +0200
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        Lawrence Stewart <lstewart@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r209119 - head/sys/sys
Message-ID:  <4C14B0EA.8090500@FreeBSD.org>
In-Reply-To: <20100613101025.GD1320@garage.freebsd.pl>
References:  <201006130239.o5D2du3m086332@svn.freebsd.org> <20100613101025.GD1320@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

>>
>> +/*
>> + * Utility macros.
>> + */
>> +#define DPCPU_SUM(n, var, sum)						\
>> +do {									\
>> +	(sum) = 0;							\
>> +	u_int i;							\
>> +	CPU_FOREACH(i)							\
>> +		(sum) += (DPCPU_ID_PTR(i, n))->var;			\
>> +} while (0)
>>      
> I'd suggest first swapping variable declaration and '(sum) = 0;'.
> Also using 'i' as a counter in macro can easly lead to name collision.
> If you need to do it, I'd suggest '_i' or something.
> Maybe it would be better to make it an inline function rather than macro?
>    
And why using old BSD-stlye u_int? style(9) also suggest using ISO C types.

-- 
Gabor Kovesdan
FreeBSD Volunteer

EMAIL: gabor@FreeBSD.org .:|:. gabor@kovesdan.org
WEB:   http://people.FreeBSD.org/~gabor .:|:. http://kovesdan.org




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C14B0EA.8090500>