[BACK]Return to STYLE.TXT CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / dist / ipf

File: [cvs.NetBSD.org] / src / dist / ipf / Attic / STYLE.TXT (download)

Revision 1.1.1.1 (vendor branch), Sun Mar 28 08:55:21 2004 UTC (20 years ago) by martti
Branch: DARRENR
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, v4-1-8, v4-1-6, v4-1-5, v4-1-34, v4-1-33, v4-1-3, v4-1-29, v4-1-23, v4-1-22, v4-1-20, v4-1-19, v4-1-13, v4-1-1, peter-altq-base, peter-altq, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3, netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, mjf-devfs2-base, mjf-devfs2, matt-premerge-20091211, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, ipfilter-4-1-23-pullup, ipfilter-4-1-22-pullup, ipfilter-4-1-20-pullup, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, abandoned-netbsd-4-base, abandoned-netbsd-4, BEFORE-IPF-4_1_23, BEFORE-IPF-4_1_22, BEFORE-IPF-4_1_20, BEFORE-IPF-4_1_19, BEFORE-IPF-4_1_13
Branch point for: yamt-pagecache
Changes since 1.1: +0 -0 lines

Import IPFilter 4.1.1

Over time, I am moving all of the IPFilter code to what I consider a better
coding style than it had before.  If you submit patches, I expect them to
conform as appropriate.

Function Comments
=================
Preceeding each and every function, a comment block like this should
be present:

/* ------------------------------------------------------------------------ */
/* Function:    function-name                                               */
/* Returns:     return-type                                                 */
/* Parameters:  param1(I) - param1 is an input parameter                    */
/*              p2(O)     - p2 is an output parameter passed as an arg      */
/*              par3(IO)  - par3 is a parameter which is both input and     */
/*                          output.  Pointers to things which are used and  */
/*                          then get a result stored in them qualify here.  */
/*                                                                          */
/* Description about what the function does.  This comment should explain   */
/* any gotchas or algorithms that are used which aren't obvious to the      */
/* casual reader.  It should not be an excuse to not use comments inside    */
/* the function.                                                            */
/* ------------------------------------------------------------------------ */


Tab spacing
===========
Tabs are to be at 8 characters.


Conditions
==========
All expressions which evaluate to a boolean for a test condition, such as
in an if()/while() statement must involve a boolean operation.  Since C
has no native boolean type, this means that one of <,>,<=,>=,==,!= must
be present.  Implied boolean evaluations are out.

In code, the following is banned:

if (x)
if (!x)
while ((a = b))

and should be replaced by:

if (x != 0)
if (x == 0)
while ((a = b) != 0)

If pointers are involved, always compare with NULL, ie.:

if (x != NULL)
if (x == NULL)
while ((a = b) != NULL)