forked from pruby/GNUnet-Mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHACKING
48 lines (39 loc) · 2.3 KB
/
HACKING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
NEW naming conventions for GNUnet:
1) All exported symbols (function names, macros and structures) should begin
with the prefix "GNUNET_". No global variables should be exported.
2) All function names should use lower-caps names with underscores. Common
abbreviations like "RSA" should be in all-caps in function names. Example:
"GNUNET_semaphore_create".
3) All macros and constants (including values in enums) should be in all-caps,
exceptions are allowed if the MACRO is really used like a normal function
in the rest of the application.
4) All structs should not have underscores (other than the underscore in
the prefix "GNUNET_") and instead use capitalization of the first letter
of every word, for example "GNUNET_HashCode" (this should be the only
minor departure from GNU's general conventions).
5) All local symbols (anything declared "static") should follow the same
conventions (except for the "GNUNET_" prefix).
6) Global symbols that are exported but should not usually be used directly
(i.e., because a convenience macro is provided), should end with an underscore.
7) For all plugins, the exported symbols must end in "_libraryname" (and
follow other conventions as established by the plugin API). Plugins should
avoid exporting symbols other than those used by the plugin API.
8) Libraries (other than gnunetutil and plugins) should add a second prefix after
the "GNUNET_" to indicate the specific GNUnet library that the functions
belong to, for example, "GNUNET_ECRS_foo_bar" for "libgnunetecrs".
NOTE:
=====
The existing codebase does not yet follow these conventions in many
places (especially with respect to local symbols and exported symbols
from plugins). Patches to fix these are welcome.
Also, the above does not specify a naming convention for fields of structs.
Using the simple no-caps with underscores notation that is also
used for local functions would make sense. An open question is if
we should distinguish function pointer in structs and normal value
fields by using a different naming convention for one of these.
Comments on this would be welcome.
HOW TO CHECK:
=============
Before every release, we should run
$ nm lib/libgnunet*.so | grep " T " | grep -v GNUNET_ | grep -v " T _"
on the installed GNUnet libraries. The output should be empty.