1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <title>Privoxy Developer Manual</title>
6 <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
7 <link rel="NEXT" title="Introduction" href="introduction.html">
8 <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
11 <body class="ARTICLE" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <div class="TITLEPAGE">
14 <h1 class="TITLE"><a name="AEN2" id="AEN2">Privoxy Developer Manual</a></h1>
15 <p class="PUBDATE"><sub><a href="https://www.privoxy.org/user-manual/copyright.html" target="_top">Copyright</a>
16 © 2001-2021 by <a href="https://www.privoxy.org/" target="_top">Privoxy Developers</a></sub><br></p>
18 <div class="ABSTRACT">
19 <a name="AEN8" id="AEN8"></a>
20 <p>The developer manual provides guidance on coding, testing, packaging, documentation and other issues of
21 importance to those involved with <span class="APPLICATION">Privoxy</span> development. It is mandatory (and
22 helpful!) reading for anyone who wants to join the team. Note that it's currently out of date and may not be
23 entirely correct. As always, patches are welcome.</p>
24 <p>Please note that this document is constantly evolving. This copy represents the state at the release of
25 version 3.0.34. You can find the latest version of the this manual at <a href=
26 "https://www.privoxy.org/developer-manual/" target="_top">https://www.privoxy.org/developer-manual/</a>.
27 Please have a look at the <a href="https://www.privoxy.org/user-manual/contact.html" target="_top">contact
28 section in the user manual</a> if you are interested in contacting the developers.</p>
35 <dt><b>Table of Contents</b></dt>
36 <dt>1. <a href="introduction.html">Introduction</a></dt>
39 <dt>1.1. <a href="introduction.html#QUICKSTART">Quickstart to Privoxy Development</a></dt>
42 <dt>2. <a href="git.html">The Git Repository</a></dt>
45 <dt>2.1. <a href="git.html#GITACCESS">Access to Git</a></dt>
46 <dt>2.2. <a href="git.html#GITBRANCHES">Branches</a></dt>
47 <dt>2.3. <a href="git.html#GITCOMMIT">Git Commit Guidelines</a></dt>
50 <dt>3. <a href="documentation.html">Documentation Guidelines</a></dt>
53 <dt>3.1. <a href="documentation.html#SGML">Quickstart to Docbook and SGML</a></dt>
54 <dt>3.2. <a href="documentation.html#DOCSTYLE"><span class="APPLICATION">Privoxy</span> Documentation
56 <dt>3.3. <a href="documentation.html#CUSTOM-ENTITIES">Privoxy Custom Entities</a></dt>
59 <dt>4. <a href="coding.html">Coding Guidelines</a></dt>
62 <dt>4.1. <a href="coding.html#S1">Introduction</a></dt>
63 <dt>4.2. <a href="coding.html#S2">Using Comments</a></dt>
66 <dt>4.2.1. <a href="coding.html#S3">Comment, Comment, Comment</a></dt>
67 <dt>4.2.2. <a href="coding.html#S4">Use blocks for comments</a></dt>
68 <dt>4.2.3. <a href="coding.html#S5">Keep Comments on their own line</a></dt>
69 <dt>4.2.4. <a href="coding.html#S6">Comment each logical step</a></dt>
70 <dt>4.2.5. <a href="coding.html#S7">Comment All Functions Thoroughly</a></dt>
71 <dt>4.2.6. <a href="coding.html#S8">Comment at the end of braces if the content is more than one screen
75 <dt>4.3. <a href="coding.html#S9">Naming Conventions</a></dt>
78 <dt>4.3.1. <a href="coding.html#S10">Variable Names</a></dt>
79 <dt>4.3.2. <a href="coding.html#S11">Function Names</a></dt>
80 <dt>4.3.3. <a href="coding.html#S12">Header file prototypes</a></dt>
81 <dt>4.3.4. <a href="coding.html#S13">Enumerations, and #defines</a></dt>
82 <dt>4.3.5. <a href="coding.html#S14">Constants</a></dt>
85 <dt>4.4. <a href="coding.html#S15">Using Space</a></dt>
88 <dt>4.4.1. <a href="coding.html#S16">Put braces on a line by themselves.</a></dt>
89 <dt>4.4.2. <a href="coding.html#S17">ALL control statements should have a block</a></dt>
90 <dt>4.4.3. <a href="coding.html#S18">Do not belabor/blow-up boolean expressions</a></dt>
91 <dt>4.4.4. <a href="coding.html#S19">Use white space freely because it is free</a></dt>
92 <dt>4.4.5. <a href="coding.html#S20">Don't use white space around structure operators</a></dt>
93 <dt>4.4.6. <a href="coding.html#S21">Make the last brace of a function stand out</a></dt>
94 <dt>4.4.7. <a href="coding.html#S22">Use 3 character indentions</a></dt>
97 <dt>4.5. <a href="coding.html#S23">Initializing</a></dt>
100 <dt>4.5.1. <a href="coding.html#S24">Initialize all variables</a></dt>
103 <dt>4.6. <a href="coding.html#S25">Functions</a></dt>
106 <dt>4.6.1. <a href="coding.html#S26">Name functions that return a boolean as a question.</a></dt>
107 <dt>4.6.2. <a href="coding.html#S27">Always specify a return type for a function.</a></dt>
108 <dt>4.6.3. <a href="coding.html#S28">Minimize function calls when iterating by using variables</a></dt>
109 <dt>4.6.4. <a href="coding.html#S29">Pass and Return by Const Reference</a></dt>
110 <dt>4.6.5. <a href="coding.html#S30">Pass and Return by Value</a></dt>
111 <dt>4.6.6. <a href="coding.html#S31">Names of include files</a></dt>
112 <dt>4.6.7. <a href="coding.html#S32">Provide multiple inclusion protection</a></dt>
113 <dt>4.6.8. <a href="coding.html#S33">Use `extern "C"` when appropriate</a></dt>
114 <dt>4.6.9. <a href="coding.html#S34">Where Possible, Use Forward Struct Declaration Instead of
118 <dt>4.7. <a href="coding.html#S35">General Coding Practices</a></dt>
121 <dt>4.7.1. <a href="coding.html#S36">Turn on warnings</a></dt>
122 <dt>4.7.2. <a href="coding.html#S37">Provide a default case for all switch statements</a></dt>
123 <dt>4.7.3. <a href="coding.html#S38">Try to avoid falling through cases in a switch statement.</a></dt>
124 <dt>4.7.4. <a href="coding.html#S40">Don't mix size_t and other types</a></dt>
125 <dt>4.7.5. <a href="coding.html#S41">Declare each variable and struct on its own line.</a></dt>
126 <dt>4.7.6. <a href="coding.html#S42">Use malloc/zalloc sparingly</a></dt>
127 <dt>4.7.7. <a href="coding.html#S43">The Programmer Who Uses 'malloc' is Responsible for Ensuring
129 <dt>4.7.8. <a href="coding.html#S44">Add loaders to the `file_list' structure and in order</a></dt>
130 <dt>4.7.9. <a href="coding.html#S45">"Uncertain" new code and/or changes to existing code, use
134 <dt>4.8. <a href="coding.html#S46">Addendum: Template for files and function comment blocks:</a></dt>
137 <dt>5. <a href="testing.html">Testing Guidelines</a></dt>
140 <dt>5.1. <a href="testing.html#TESTING-PLAN">Testplan for releases</a></dt>
141 <dt>5.2. <a href="testing.html#PRIVOXY-REGRESSION-TEST">Testing with <span class=
142 "APPLICATION">Privoxy-Regression-Test</span></a></dt>
143 <dt>5.3. <a href="testing.html#FUZZING">Fuzzing Privoxy</a></dt>
146 <dt>6. <a href="newrelease.html">Releasing a New Version</a></dt>
149 <dt>6.1. <a href="newrelease.html#VERSIONNUMBERS">Version numbers</a></dt>
150 <dt>6.2. <a href="newrelease.html#BEFORERELEASE">Before the Release</a></dt>
151 <dt>6.3. <a href="newrelease.html#THERELEASE">Building and Releasing the Packages</a></dt>
154 <dt>6.3.1. <a href="newrelease.html#PACK-GUIDELINES">Note on Privoxy Packaging</a></dt>
155 <dt>6.3.2. <a href="newrelease.html#NEWRELEASE-TARBALL">Source Tarball</a></dt>
156 <dt>6.3.3. <a href="newrelease.html#NEWRELEASE-WINDOWS">Windows</a></dt>
157 <dt>6.3.4. <a href="newrelease.html#NEWRELEASE-DEBIAN">Debian</a></dt>
158 <dt>6.3.5. <a href="newrelease.html#NEWRELEASE-MACOSX">macOS / OS X</a></dt>
159 <dt>6.3.6. <a href="newrelease.html#NEWRELEASE-FREEBSD">FreeBSD</a></dt>
162 <dt>6.4. <a href="newrelease.html#RELEASING">Uploading and Releasing Your Package</a></dt>
163 <dt>6.5. <a href="newrelease.html#AFTERRELEASE">After the Release</a></dt>
166 <dt>7. <a href="webserver-update.html">Update the Webserver</a></dt>
170 <div class="NAVFOOTER">
171 <hr align="left" width="100%">
172 <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
174 <td width="33%" align="left" valign="top"> </td>
175 <td width="34%" align="center" valign="top"> </td>
176 <td width="33%" align="right" valign="top"><a href="introduction.html" accesskey="N">Next</a></td>
179 <td width="33%" align="left" valign="top"> </td>
180 <td width="34%" align="center" valign="top"> </td>
181 <td width="33%" align="right" valign="top">Introduction</td>