summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-10-14 10:40:27 -0400
committerNick Mathewson <nickm@torproject.org>2015-10-14 10:40:27 -0400
commit49ccb7e7b88d38a572277824a344ad423494a293 (patch)
treed1469f9bb6b93e4df08e60e3b1883fe059aaa45a /doc
parent8182715a2b983fc3e48c5092a0a4aaa7ffc49388 (diff)
downloadtor-49ccb7e7b88d38a572277824a344ad423494a293.tar.gz
tor-49ccb7e7b88d38a572277824a344ad423494a293.zip
Mention trunnel in CodingStandards; describe how in trunnel/README
Diffstat (limited to 'doc')
-rw-r--r--doc/HACKING/CodingStandards.txt25
1 files changed, 20 insertions, 5 deletions
diff --git a/doc/HACKING/CodingStandards.txt b/doc/HACKING/CodingStandards.txt
index fa4990d368..2d03b8e3b2 100644
--- a/doc/HACKING/CodingStandards.txt
+++ b/doc/HACKING/CodingStandards.txt
@@ -122,20 +122,35 @@ using gcc, you should invoke the configure script with the option
"--enable-gcc-warnings". This will give a bunch of extra warning flags to
the compiler, and help us find divergences from our preferred C style.
-Functions to use
-~~~~~~~~~~~~~~~~
+Functions to use; functions not to use.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We have some wrapper functions like tor_malloc, tor_free, tor_strdup, and
tor_gettimeofday; use them instead of their generic equivalents. (They
always succeed or exit.)
You can get a full list of the compatibility functions that Tor provides by
-looking through src/common/util.h and src/common/compat.h. You can see the
-available containers in src/common/containers.h. You should probably
+looking through src/common/util*.h and src/common/compat*.h. You can see the
+available containers in src/common/containers*.h. You should probably
familiarize yourself with these modules before you write too much code, or
else you'll wind up reinventing the wheel.
-Use 'INLINE' instead of 'inline', so that we work properly on Windows.
+Use 'INLINE' instead of 'inline' -- it's a vestige of an old hack to make
+sure that we worked on MSVC6.
+
+We don't use strcat or strcpy or sprintf of any of those notoriously broken
+old C functions. Use strlcat, strlcpy, or tor_snprintf/tor_asprintf instead.
+
+Functions not to write
+~~~~~~~~~~~~~~~~~~~~~~
+
+Try to never hand-write new code to parse or generate binary
+formats. Instead, use trunnel if at all possible. See
+ https://gitweb.torproject.org/trunnel.git/tree
+for more information about trunnel.
+
+For information on adding new trunnel code to Tor, see src/trunnel/README
+
Calling and naming conventions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~