From owner-cvs-all Sun Oct 28 22: 5:57 2001 Delivered-To: cvs-all@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 53A4E37B403; Sun, 28 Oct 2001 22:05:52 -0800 (PST) Received: from localhost (arr@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f9T65jR33693; Mon, 29 Oct 2001 01:05:45 -0500 (EST) (envelope-from arr@watson.org) Date: Mon, 29 Oct 2001 01:05:44 -0500 (EST) From: "Andrew R. Reiter" To: Luigi Rizzo Cc: Josef Karthauser , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: ipfw.c -- (was: cvs commit: src/sys/netinet ip_fw.h) In-Reply-To: <20011028215038.C94510@iguana.aciri.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 28 Oct 2001, Luigi Rizzo wrote: : :i seem to remember something about variable scoping in the style(9) :manpage, but i cannot find it anymore in FreeBSD 4.3. In 4.4-RELEASE, style.9 says: Parts of a for loop may be left empty. Don't put declarations inside blocks unless the routine is unusually complicated. In ipfw.c, there are a number of areas in which it does not make sense, in terms of style.9, to declare a variable as local to the point where it's no longer at the head of a function. Ie: if (chain->fw_flg & IP_FW_F_RND_MATCH) { double d = 1.0 * chain->dont_match_prob; d = 1 - (d / 0x7fffffff); printf("prob %f ", d); } & if (do_time) { if (chain->timestamp) { char timestr[30]; strcpy(timestr, ctime((time_t *)&chain->timestamp)); *strchr(timestr, '\n') = '\0'; printf("%s ", timestr); } else { printf(" "); } } :-/ *-------------................................................. | Andrew R. Reiter | arr@fledge.watson.org | "It requires a very unusual mind | to undertake the analysis of the obvious" -- A.N. Whitehead To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message