Date: Mon, 29 Oct 2001 01:05:44 -0500 (EST) From: "Andrew R. Reiter" <arr@watson.org> To: Luigi Rizzo <rizzo@aciri.org> Cc: Josef Karthauser <joe@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: ipfw.c -- (was: cvs commit: src/sys/netinet ip_fw.h) Message-ID: <Pine.NEB.3.96L.1011029010151.33440A-100000@fledge.watson.org> In-Reply-To: <20011028215038.C94510@iguana.aciri.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1011029010151.33440A-100000>