Catchup with recent corrections (minor).
[privoxy.git] / doc / webserver / developer-manual / coding.html
index fead798..945acb1 100644 (file)
@@ -1,11 +1,11 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML
 ><HEAD
 ><TITLE
 >Coding Guidelines</TITLE
 ><META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
+"><LINK
 REL="HOME"
 TITLE="Privoxy Developer Manual"
 HREF="index.html"><LINK
@@ -74,16 +74,16 @@ CLASS="SECT1"
 CLASS="SECT1"
 ><A
 NAME="CODING"
->4. Coding Guidelines</A
-></H1
+></A
+>4. Coding Guidelines</H1
 ><DIV
 CLASS="SECT2"
 ><H2
 CLASS="SECT2"
 ><A
 NAME="S1"
->4.1. Introduction</A
-></H2
+></A
+>4.1. Introduction</H2
 ><P
 >This set of standards is designed to make our lives easier.  It is
     developed with the simple goal of helping us keep the "new and improved
@@ -105,16 +105,16 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S2"
->4.2. Using Comments</A
-></H2
+></A
+>4.2. Using Comments</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S3"
->4.2.1. Comment, Comment, Comment</A
-></H3
+></A
+>4.2.1. Comment, Comment, Comment</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -177,8 +177,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S4"
->4.2.2. Use blocks for comments</A
-></H3
+></A
+>4.2.2. Use blocks for comments</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -251,8 +251,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S5"
->4.2.3. Keep Comments on their own line</A
-></H3
+></A
+>4.2.3. Keep Comments on their own line</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -330,8 +330,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S6"
->4.2.4. Comment each logical step</A
-></H3
+></A
+>4.2.4. Comment each logical step</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -359,8 +359,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S7"
->4.2.5. Comment All Functions Thoroughly</A
-></H3
+></A
+>4.2.5. Comment All Functions Thoroughly</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -389,9 +389,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S8"
+></A
 >4.2.6. Comment at the end of braces if the
-    content is more than one screen length</A
-></H3
+    content is more than one screen length</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -452,16 +452,16 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S9"
->4.3. Naming Conventions</A
-></H2
+></A
+>4.3. Naming Conventions</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S10"
->4.3.1. Variable Names</A
-></H3
+></A
+>4.3.1. Variable Names</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -526,8 +526,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S11"
->4.3.2. Function Names</A
-></H3
+></A
+>4.3.2. Function Names</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -593,8 +593,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S12"
->4.3.3. Header file prototypes</A
-></H3
+></A
+>4.3.3. Header file prototypes</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -658,8 +658,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S13"
->4.3.4. Enumerations, and #defines</A
-></H3
+></A
+>4.3.4. Enumerations, and #defines</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -734,8 +734,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S14"
->4.3.5. Constants</A
-></H3
+></A
+>4.3.5. Constants</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -806,16 +806,16 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S15"
->4.4. Using Space</A
-></H2
+></A
+>4.4. Using Space</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S16"
->4.4.1. Put braces on a line by themselves.</A
-></H3
+></A
+>4.4.1. Put braces on a line by themselves.</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -920,9 +920,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S17"
+></A
 >4.4.2. ALL control statements should have a
-    block</A
-></H3
+    block</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -992,9 +992,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S18"
+></A
 >4.4.3. Do not belabor/blow-up boolean
-    expressions</A
-></H3
+    expressions</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1044,9 +1044,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S19"
+></A
 >4.4.4. Use white space freely because it is
-    free</A
-></H3
+    free</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1092,9 +1092,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S20"
+></A
 >4.4.5. Don't use white space around structure
-    operators</A
-></H3
+    operators</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1149,9 +1149,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S21"
+></A
 >4.4.6. Make the last brace of a function stand
-    out</A
-></H3
+    out</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1223,8 +1223,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S22"
->4.4.7. Use 3 character indentions</A
-></H3
+></A
+>4.4.7. Use 3 character indentions</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1285,16 +1285,16 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S23"
->4.5. Initializing</A
-></H2
+></A
+>4.5. Initializing</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S24"
->4.5.1. Initialize all variables</A
-></H3
+></A
+>4.5.1. Initialize all variables</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1358,17 +1358,17 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S25"
->4.6. Functions</A
-></H2
+></A
+>4.6. Functions</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S26"
+></A
 >4.6.1. Name functions that return a boolean as a
-    question.</A
-></H3
+    question.</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1409,9 +1409,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S27"
+></A
 >4.6.2. Always specify a return type for a
-    function.</A
-></H3
+    function.</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1432,9 +1432,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S28"
+></A
 >4.6.3. Minimize function calls when iterating by
-    using variables</A
-></H3
+    using variables</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1531,8 +1531,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S29"
->4.6.4. Pass and Return by Const Reference</A
-></H3
+></A
+>4.6.4. Pass and Return by Const Reference</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1561,8 +1561,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S30"
->4.6.5. Pass and Return by Value</A
-></H3
+></A
+>4.6.5. Pass and Return by Value</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1586,8 +1586,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S31"
->4.6.6. Names of include files</A
-></H3
+></A
+>4.6.6. Names of include files</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1664,9 +1664,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S32"
+></A
 >4.6.7. Provide multiple inclusion
-    protection</A
-></H3
+    protection</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1713,8 +1713,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S33"
->4.6.8. Use `extern "C"` when appropriate</A
-></H3
+></A
+>4.6.8. Use `extern "C"` when appropriate</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1763,9 +1763,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S34"
+></A
 >4.6.9. Where Possible, Use Forward Struct
-    Declaration Instead of Includes</A
-></H3
+    Declaration Instead of Includes</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1829,16 +1829,16 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S35"
->4.7. General Coding Practices</A
-></H2
+></A
+>4.7. General Coding Practices</H2
 ><DIV
 CLASS="SECT3"
 ><H3
 CLASS="SECT3"
 ><A
 NAME="S36"
->4.7.1. Turn on warnings</A
-></H3
+></A
+>4.7.1. Turn on warnings</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1858,9 +1858,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S37"
+></A
 >4.7.2. Provide a default case for all switch
-    statements</A
-></H3
+    statements</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1946,9 +1946,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S38"
+></A
 >4.7.3. Try to avoid falling through cases in a
-    switch statement.</A
-></H3
+    switch statement.</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -1980,9 +1980,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S39"
+></A
 >4.7.4. Use 'long' or 'short' Instead of
-    'int'</A
-></H3
+    'int'</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2013,8 +2013,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S40"
->4.7.5. Don't mix size_t and other types</A
-></H3
+></A
+>4.7.5. Don't mix size_t and other types</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2037,9 +2037,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S41"
+></A
 >4.7.6. Declare each variable and struct on its
-    own line.</A
-></H3
+    own line.</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2121,8 +2121,8 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S42"
->4.7.7. Use malloc/zalloc sparingly</A
-></H3
+></A
+>4.7.7. Use malloc/zalloc sparingly</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2165,9 +2165,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S43"
+></A
 >4.7.8. The Programmer Who Uses 'malloc' is
-    Responsible for Ensuring 'free'</A
-></H3
+    Responsible for Ensuring 'free'</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2234,9 +2234,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S44"
+></A
 >4.7.9. Add loaders to the `file_list' structure
-    and in order</A
-></H3
+    and in order</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2267,9 +2267,9 @@ CLASS="SECT3"
 CLASS="SECT3"
 ><A
 NAME="S45"
+></A
 >4.7.10. "Uncertain" new code and/or changes to
-    existing code, use FIXME</A
-></H3
+    existing code, use FIXME</H3
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2315,9 +2315,9 @@ CLASS="SECT2"
 CLASS="SECT2"
 ><A
 NAME="S46"
+></A
 >4.8. Addendum: Template for files and function
-    comment blocks:</A
-></H2
+    comment blocks:</H2
 ><P
 ><SPAN
 CLASS="emphasis"
@@ -2334,14 +2334,14 @@ WIDTH="100%"
 ><TD
 ><PRE
 CLASS="PROGRAMLISTING"
->const char FILENAME_rcs[] = "$Id: coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes Exp $";
+>const char FILENAME_rcs[] = "$Id: developer-manual.sgml,v 2.9 2006/09/14 02:30:07 hal9 Exp $";
 /*********************************************************************
  *
- * File        :  $Source: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v $
+ * File        :  $Source$
  *
  * Purpose     :  (Fill me in with a good description!)
  *
- * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
+ * Copyright   :  Written by and Copyright (C) 2001-2006 the SourceForge
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
@@ -2363,14 +2363,12 @@ CLASS="PROGRAMLISTING"
  *                The GNU General Public License should be included with
  *                this file.  If not, you can view it at
  *                http://www.gnu.org/copyleft/gpl.html
- *                or write to the Free Software Foundation, Inc., 59
- *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *                or write to the Free Software Foundation, Inc., 
+ *                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
+ *                USA
  *
  * Revisions   :
- *    $Log: coding.html,v $
- *    Revision 1.19.2.7  2004/01/31 00:05:44  oes
- *    Regenerated from sgml source
- *
+ *    $Log$
  *
  *********************************************************************/
 
@@ -2424,14 +2422,14 @@ WIDTH="100%"
 CLASS="PROGRAMLISTING"
 >#ifndef _FILENAME_H
 #define _FILENAME_H
-#define FILENAME_H_VERSION "$Id: coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes Exp $"
+#define FILENAME_H_VERSION "$Id: developer-manual.sgml,v 2.9 2006/09/14 02:30:07 hal9 Exp $"
 /*********************************************************************
  *
- * File        :  $Source: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v $
+ * File        :  $Source$
  *
  * Purpose     :  (Fill me in with a good description!)
  *
- * Copyright   :  Written by and Copyright (C) 2001 the SourceForge
+ * Copyright   :  Written by and Copyright (C) 2001-2006 the SourceForge
  *                Privoxy team. http://www.privoxy.org/
  *
  *                Based on the Internet Junkbuster originally written
@@ -2453,14 +2451,12 @@ CLASS="PROGRAMLISTING"
  *                The GNU General Public License should be included with
  *                this file.  If not, you can view it at
  *                http://www.gnu.org/copyleft/gpl.html
- *                or write to the Free Software Foundation, Inc., 59
- *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *                or write to the Free Software Foundation, Inc., 
+ *                51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
+ *                USA
  *
  * Revisions   :
- *    $Log: coding.html,v $
- *    Revision 1.19.2.7  2004/01/31 00:05:44  oes
- *    Regenerated from sgml source
- *
+ *    $Log$
  *
  *********************************************************************/