]> git.sur5r.net Git - openldap/blob - doc/devel/guidelines
Add ber_bvstr and ber_bvstrdup string to berval allocators.
[openldap] / doc / devel / guidelines
1
2 This document is being replaced with:
3         http://www.openldap.org/devel/programming.html
4 and
5         http://www.openldap.org/devel/contributing.html
6
7 However, some of the info here is still useful.
8
9 Coding guide lines and and hints for OpenLDAP developers.
10 =========================================================
11
12 Please add to this file when new points come up.
13
14
15 C source
16 --------
17
18 OpenLDAP requires many Standard C features to *build*.  This
19 includes functional prototypes and offsetof macro.  It is
20 possible to *build* OpenLDAP with a number of C translators
21 which are not fully compliant with Standard C.
22
23 OpenLDAP supports compiling and linking *with* applications
24 with most C compilers and libraries.   The installed headers
25 are designed to provide K&R C compatiable function declarations
26 on non-standard compilers.  In cases where the compiler does
27 not define __STDC__ but requires prototypes (ie: MSVC), the
28 application should define LDAP_NEEDS_PROTOTYPES.  In cases
29 where the compiler does define __STDC__ but does not support
30 prototypes, the application should define LDAP_NO_PROTOTYPES.
31
32 .c files in the OpenLDAP source tree MUST #include "portable.h" before
33 any other include file, even system includes.  portable.h may control
34 aspects of system includes, such as whether or not thread-safe library
35 functions are used.  (Separate applications can't use portable.h, since
36 it is not installed.  They can use ldap_features.h, though.)
37
38 .h files that are NOT INSTALLED may depend on features from portable.h.
39 .h files that *are* installed (from include/) should not depend on it.
40
41 Avoid unnecessary changes, like reindenting code, even if that leaves
42 the code a little ugly.  Often switching your editors tab stops to
43 4 or 8 may make code easier to read.  Unnecessary changes make it
44 harder to maintain and merge different CVS branches of the source.
45
46 Please follow the style of surrounding code.
47
48 Use feature-specific #if tests (like #ifdef HAVE_LWP) which configure
49 can figure out, not system-specific test (like #ifdef __SunOS_5_6).
50
51 When available, use include files from ldap/include/ac/ to get system
52 features or functions.  The <ac/xxx.h> files try to fix crippled system
53 includes, and to hide #ifdef messes that portable programs need in order
54 to find a feature.  Note that a file <ac/xxx.h> is not necessarily
55 designed to be equivalent to standard C's <xxx.h> file.
56
57 Nonstatic function and variable definitions in .c files should be
58 preceded by their declarations in .h files.  Avoid implicit function
59 declarations.  External declarations with should be avoided.  In
60 .c files, include the appropriate .h file to obtain the declaration.
61 If the declaration is not available in any system header, add it
62 to the most appropriate ac/xxx.h header.  Do NOT add extern
63 declarations to .c files.
64
65 When a function returns non-void, it should return a meaningful value.
66 Avoid implicit int.
67
68 It is recommended that ldap_cdef.h macros LDAP_F and LDAP_P be used
69 even for non-installed headers.  See lber.h and ldap.h for examples.
70
71
72 CVS updating
73 ------------
74
75 <URL:http://www.openldap.org/software/repo.html> describes how to check out
76 -stable.  To get the -devel (HEAD) branch, omit `-r OPENLDAP_STABLE'.
77 You can use 'cvs status -v README' to get a list available CVS tags.
78
79 Core members should subscribe to the -core mailing list.  This
80 list is for private discussions between core team members.  The
81 openldap-devel@openldap.org mailing list is the primary developer
82 forum for both  technical disscusions and coordinating efforts.
83
84 Please test patches before committing.  This should include compiling
85 and linking the system AND running the test suite.
86
87 In general, a patch/bugfix should be applied to -devel and tested.
88 When the patch is considered stable, then it can be merged into -stable.
89 Same goes for other release engineering branches (like
90 OPENLDAP_REL_ENG_1_1).  (-stable is rel eng 1.0).
91 Specific procjects may get their own branches, to be merged later.
92
93 Log messages: Just describe the change and reason.  CVS adds your name,
94 date, etc.
95
96
97 Various tips and hints
98 ----------------------
99
100 How to correct a CVS log message:
101 Commit the unchanged files again with the `-f' flag and with a log
102 message stating how the previous log was in error:
103         cvs commit -f cldap.c os-ip.c
104 Preferably, prepend a line something like this to the message:
105 "Forced commit to correct previous log, files were not changed."
106
107 Modify ldapconfig.h instead of ldapconfig.h.edit.  Then `cvs commit'
108 from the include directory won't accidentally commit your private
109 ldapconfig.h.edit.