1
2Over time, I am moving all of the IPFilter code to what I consider a better
3coding style than it had before.  If you submit patches, I expect them to
4conform as appropriate.
5
6Function Comments
7=================
8Preceeding each and every function, a comment block like this should
9be present:
10
11/* ------------------------------------------------------------------------ */
12/* Function:    function-name                                               */
13/* Returns:     return-type                                                 */
14/* Parameters:  param1(I) - param1 is an input parameter                    */
15/*              p2(O)     - p2 is an output parameter passed as an arg      */
16/*              par3(IO)  - par3 is a parameter which is both input and     */
17/*                          output.  Pointers to things which are used and  */
18/*                          then get a result stored in them qualify here.  */
19/*                                                                          */
20/* Description about what the function does.  This comment should explain   */
21/* any gotchas or algorithms that are used which aren't obvious to the      */
22/* casual reader.  It should not be an excuse to not use comments inside    */
23/* the function.                                                            */
24/* ------------------------------------------------------------------------ */
25
26
27Tab spacing
28===========
29Tabs are to be at 8 characters.
30
31
32Conditions
33==========
34All expressions which evaluate to a boolean for a test condition, such as
35in an if()/while() statement must involve a boolean operation.  Since C
36has no native boolean type, this means that one of <,>,<=,>=,==,!= must
37be present.  Implied boolean evaluations are out.
38
39In code, the following is banned:
40
41if (x)
42if (!x)
43while ((a = b))
44
45and should be replaced by:
46
47if (x != 0)
48if (x == 0)
49while ((a = b) != 0)
50
51If pointers are involved, always compare with NULL, ie.:
52
53if (x != NULL)
54if (x == NULL)
55while ((a = b) != NULL)
56
57
58