projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
[privoxy.git]
/
doc
/
webserver
/
developer-manual
/
coding.html
diff --git
a/doc/webserver/developer-manual/coding.html
b/doc/webserver/developer-manual/coding.html
index
ca973e3
..
fead798
100644
(file)
--- a/
doc/webserver/developer-manual/coding.html
+++ b/
doc/webserver/developer-manual/coding.html
@@
-1,11
+1,11
@@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Coding Guidelines</TITLE
><META
NAME="GENERATOR"
<HTML
><HEAD
><TITLE
>Coding Guidelines</TITLE
><META
NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
-"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Privoxy Developer Manual"
HREF="index.html"><LINK
REL="HOME"
TITLE="Privoxy Developer Manual"
HREF="index.html"><LINK
@@
-73,13
+73,17
@@
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
><H1
CLASS="SECT1"
><A
-NAME="CODING">4. Coding Guidelines</H1
+NAME="CODING"
+>4. Coding Guidelines</A
+></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
-NAME="S1">4.1. Introduction</H2
+NAME="S1"
+>4.1. Introduction</A
+></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
><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
@@
-100,13
+104,17
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S2">4.2. Using Comments</H2
+NAME="S2"
+>4.2. Using Comments</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S3">4.2.1. Comment, Comment, Comment</H3
+NAME="S3"
+>4.2.1. Comment, Comment, Comment</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-168,7
+176,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S4">4.2.2. Use blocks for comments</H3
+NAME="S4"
+>4.2.2. Use blocks for comments</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-240,7
+250,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S5">4.2.3. Keep Comments on their own line</H3
+NAME="S5"
+>4.2.3. Keep Comments on their own line</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-317,7
+329,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S6">4.2.4. Comment each logical step</H3
+NAME="S6"
+>4.2.4. Comment each logical step</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-344,7
+358,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S7">4.2.5. Comment All Functions Thoroughly</H3
+NAME="S7"
+>4.2.5. Comment All Functions Thoroughly</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-372,8
+388,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S8">4.2.6. Comment at the end of braces if the
- content is more than one screen length</H3
+NAME="S8"
+>4.2.6. Comment at the end of braces if the
+ content is more than one screen length</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-433,13
+451,17
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S9">4.3. Naming Conventions</H2
+NAME="S9"
+>4.3. Naming Conventions</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S10">4.3.1. Variable Names</H3
+NAME="S10"
+>4.3.1. Variable Names</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-503,7
+525,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S11">4.3.2. Function Names</H3
+NAME="S11"
+>4.3.2. Function Names</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-568,7
+592,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S12">4.3.3. Header file prototypes</H3
+NAME="S12"
+>4.3.3. Header file prototypes</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-631,7
+657,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S13">4.3.4. Enumerations, and #defines</H3
+NAME="S13"
+>4.3.4. Enumerations, and #defines</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-705,7
+733,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S14">4.3.5. Constants</H3
+NAME="S14"
+>4.3.5. Constants</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-775,13
+805,17
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S15">4.4. Using Space</H2
+NAME="S15"
+>4.4. Using Space</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S16">4.4.1. Put braces on a line by themselves.</H3
+NAME="S16"
+>4.4.1. Put braces on a line by themselves.</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-885,8
+919,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S17">4.4.2. ALL control statements should have a
- block</H3
+NAME="S17"
+>4.4.2. ALL control statements should have a
+ block</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-955,8
+991,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S18">4.4.3. Do not belabor/blow-up boolean
- expressions</H3
+NAME="S18"
+>4.4.3. Do not belabor/blow-up boolean
+ expressions</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1005,8
+1043,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S19">4.4.4. Use white space freely because it is
- free</H3
+NAME="S19"
+>4.4.4. Use white space freely because it is
+ free</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1051,8
+1091,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S20">4.4.5. Don't use white space around structure
- operators</H3
+NAME="S20"
+>4.4.5. Don't use white space around structure
+ operators</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1106,8
+1148,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S21">4.4.6. Make the last brace of a function stand
- out</H3
+NAME="S21"
+>4.4.6. Make the last brace of a function stand
+ out</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1178,7
+1222,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S22">4.4.7. Use 3 character indentions</H3
+NAME="S22"
+>4.4.7. Use 3 character indentions</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1238,13
+1284,17
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S23">4.5. Initializing</H2
+NAME="S23"
+>4.5. Initializing</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S24">4.5.1. Initialize all variables</H3
+NAME="S24"
+>4.5.1. Initialize all variables</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1307,14
+1357,18
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S25">4.6. Functions</H2
+NAME="S25"
+>4.6. Functions</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S26">4.6.1. Name functions that return a boolean as a
- question.</H3
+NAME="S26"
+>4.6.1. Name functions that return a boolean as a
+ question.</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1354,8
+1408,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S27">4.6.2. Always specify a return type for a
- function.</H3
+NAME="S27"
+>4.6.2. Always specify a return type for a
+ function.</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1375,8
+1431,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S28">4.6.3. Minimize function calls when iterating by
- using variables</H3
+NAME="S28"
+>4.6.3. Minimize function calls when iterating by
+ using variables</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1472,7
+1530,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S29">4.6.4. Pass and Return by Const Reference</H3
+NAME="S29"
+>4.6.4. Pass and Return by Const Reference</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1500,7
+1560,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S30">4.6.5. Pass and Return by Value</H3
+NAME="S30"
+>4.6.5. Pass and Return by Value</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1523,7
+1585,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S31">4.6.6. Names of include files</H3
+NAME="S31"
+>4.6.6. Names of include files</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1599,8
+1663,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S32">4.6.7. Provide multiple inclusion
- protection</H3
+NAME="S32"
+>4.6.7. Provide multiple inclusion
+ protection</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1646,7
+1712,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S33">4.6.8. Use `extern "C"` when appropriate</H3
+NAME="S33"
+>4.6.8. Use `extern "C"` when appropriate</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1694,8
+1762,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S34">4.6.9. Where Possible, Use Forward Struct
- Declaration Instead of Includes</H3
+NAME="S34"
+>4.6.9. Where Possible, Use Forward Struct
+ Declaration Instead of Includes</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1758,13
+1828,17
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S35">4.7. General Coding Practices</H2
+NAME="S35"
+>4.7. General Coding Practices</A
+></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
-NAME="S36">4.7.1. Turn on warnings</H3
+NAME="S36"
+>4.7.1. Turn on warnings</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1783,8
+1857,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S37">4.7.2. Provide a default case for all switch
- statements</H3
+NAME="S37"
+>4.7.2. Provide a default case for all switch
+ statements</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1869,8
+1945,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S38">4.7.3. Try to avoid falling through cases in a
- switch statement.</H3
+NAME="S38"
+>4.7.3. Try to avoid falling through cases in a
+ switch statement.</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1901,8
+1979,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S39">4.7.4. Use 'long' or 'short' Instead of
- 'int'</H3
+NAME="S39"
+>4.7.4. Use 'long' or 'short' Instead of
+ 'int'</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1932,7
+2012,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S40">4.7.5. Don't mix size_t and other types</H3
+NAME="S40"
+>4.7.5. Don't mix size_t and other types</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-1954,8
+2036,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S41">4.7.6. Declare each variable and struct on its
- own line.</H3
+NAME="S41"
+>4.7.6. Declare each variable and struct on its
+ own line.</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2036,7
+2120,9
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S42">4.7.7. Use malloc/zalloc sparingly</H3
+NAME="S42"
+>4.7.7. Use malloc/zalloc sparingly</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2078,8
+2164,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S43">4.7.8. The Programmer Who Uses 'malloc' is
- Responsible for Ensuring 'free'</H3
+NAME="S43"
+>4.7.8. The Programmer Who Uses 'malloc' is
+ Responsible for Ensuring 'free'</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2145,8
+2233,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S44">4.7.9. Add loaders to the `file_list' structure
- and in order</H3
+NAME="S44"
+>4.7.9. Add loaders to the `file_list' structure
+ and in order</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2176,8
+2266,10
@@
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
><H3
CLASS="SECT3"
><A
-NAME="S45">4.7.10. "Uncertain" new code and/or changes to
- existing code, use FIXME</H3
+NAME="S45"
+>4.7.10. "Uncertain" new code and/or changes to
+ existing code, use FIXME</A
+></H3
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2222,8
+2314,10
@@
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
><H2
CLASS="SECT2"
><A
-NAME="S46">4.8. Addendum: Template for files and function
- comment blocks:</H2
+NAME="S46"
+>4.8. Addendum: Template for files and function
+ comment blocks:</A
+></H2
><P
><SPAN
CLASS="emphasis"
><P
><SPAN
CLASS="emphasis"
@@
-2240,10
+2334,10
@@
WIDTH="100%"
><TD
><PRE
CLASS="PROGRAMLISTING"
><TD
><PRE
CLASS="PROGRAMLISTING"
->const char FILENAME_rcs[] = "$Id:
developer-manual.sgml,v 2.3 2002/09/05 02:27:59 hal9
Exp $";
+>const char FILENAME_rcs[] = "$Id:
coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes
Exp $";
/*********************************************************************
*
/*********************************************************************
*
- * File : $Source$
+ * File : $Source
: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v
$
*
* Purpose : (Fill me in with a good description!)
*
*
* Purpose : (Fill me in with a good description!)
*
@@
-2273,7
+2367,10
@@
CLASS="PROGRAMLISTING"
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
- * $Log$
+ * $Log: coding.html,v $
+ * Revision 1.19.2.7 2004/01/31 00:05:44 oes
+ * Regenerated from sgml source
+ *
*
*********************************************************************/
*
*********************************************************************/
@@
-2327,10
+2424,10
@@
WIDTH="100%"
CLASS="PROGRAMLISTING"
>#ifndef _FILENAME_H
#define _FILENAME_H
CLASS="PROGRAMLISTING"
>#ifndef _FILENAME_H
#define _FILENAME_H
-#define FILENAME_H_VERSION "$Id:
developer-manual.sgml,v 2.3 2002/09/05 02:27:59 hal9
Exp $"
+#define FILENAME_H_VERSION "$Id:
coding.html,v 1.19.2.7 2004/01/31 00:05:44 oes
Exp $"
/*********************************************************************
*
/*********************************************************************
*
- * File : $Source$
+ * File : $Source
: /cvsroot/ijbswa/current/doc/webserver/developer-manual/coding.html,v
$
*
* Purpose : (Fill me in with a good description!)
*
*
* Purpose : (Fill me in with a good description!)
*
@@
-2360,7
+2457,10
@@
CLASS="PROGRAMLISTING"
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
- * $Log$
+ * $Log: coding.html,v $
+ * Revision 1.19.2.7 2004/01/31 00:05:44 oes
+ * Regenerated from sgml source
+ *
*
*********************************************************************/
*
*********************************************************************/