From owner-svn-src-all@FreeBSD.ORG Mon Jun 14 13:01:58 2010 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 997211065670; Mon, 14 Jun 2010 13:01:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 1117B8FC08; Mon, 14 Jun 2010 13:01:57 +0000 (UTC) Received: from c122-106-175-69.carlnfd1.nsw.optusnet.com.au (c122-106-175-69.carlnfd1.nsw.optusnet.com.au [122.106.175.69]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o5ED1tox021971 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Jun 2010 23:01:56 +1000 Date: Mon, 14 Jun 2010 23:01:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Gabor Kovesdan In-Reply-To: <4C14B0EA.8090500@FreeBSD.org> Message-ID: <20100614225822.O37830@delplex.bde.org> References: <201006130239.o5D2du3m086332@svn.freebsd.org> <20100613101025.GD1320@garage.freebsd.pl> <4C14B0EA.8090500@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, Lawrence Stewart , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r209119 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2010 13:01:58 -0000 On Sun, 13 Jun 2010, Gabor Kovesdan wrote: >>> +/* >>> + * 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. That is for fixed-width types (uintN_t instead of u_intN_t). KNF still uses the abbreviation u_int for `unsigned' or worse `unsigned int', except where namespace issues prevent use of u_nt. Bruce