OpenLDAP, Developer Guidelines

Developer Guidelines

$OpenLDAP: pkg/ldap/doc/devel/guidelines,v 1.6 2000/01/11 00:23:24 kurt Exp $

This document is being replaced with:

However, some of the info here is still useful.

Coding guide lines and and hints for OpenLDAP developers.

Please add to this file when new points come up.

C source

OpenLDAP requires many Standard C features to *build*.  This
includes functional prototypes and offsetof macro.  It is
possible to *build* OpenLDAP with a number of C translators
which are not fully compliant with Standard C.

OpenLDAP supports compiling and linking *with* applications
with most C compilers and libraries.   The installed headers
are designed to provide K&R C compatiable function declarations
on non-standard compilers.  In cases where the compiler does
not define __STDC__ but requires prototypes (ie: MSVC), the
application should define LDAP_NEEDS_PROTOTYPES.  In cases
where the compiler does define __STDC__ but does not support
prototypes, the application should define LDAP_NO_PROTOTYPES.

.c files in the OpenLDAP source tree MUST #include "portable.h" before
any other include file, even system includes.  portable.h may control
aspects of system includes, such as whether or not thread-safe library
functions are used.  (Separate applications can't use portable.h, since
it is not installed.  They can use ldap_features.h, though.)

.h files that are NOT INSTALLED may depend on features from portable.h.
.h files that *are* installed (from include/) should not depend on it.

Avoid unnecessary changes, like reindenting code, even if that leaves
the code a little ugly.  Often switching your editors tab stops to
4 or 8 may make code easier to read.  Unnecessary changes make it
harder to maintain and merge different CVS branches of the source.

Please follow the style of surrounding code.

Use feature-specific #if tests (like #ifdef HAVE_LWP) which configure
can figure out, not system-specific test (like #ifdef __SunOS_5_6).

When available, use include files from ldap/include/ac/ to get system
features or functions.  The <ac/xxx.h> files try to fix crippled system
includes, and to hide #ifdef messes that portable programs need in order
to find a feature.  Note that a file <ac/xxx.h> is not necessarily
designed to be equivalent to standard C's <xxx.h> file.

Nonstatic function and variable definitions in .c files should be
preceded by their declarations in .h files.  Avoid implicit function
declarations.  External declarations with should be avoided.  In
.c files, include the appropriate .h file to obtain the declaration.
If the declaration is not available in any system header, add it
to the most appropriate ac/xxx.h header.  Do NOT add extern
declarations to .c files.

When a function returns non-void, it should return a meaningful value.
Avoid implicit int.

It is recommended that ldap_cdef.h macros LDAP_F and LDAP_P be used
even for non-installed headers.  See lber.h and ldap.h for examples.

CVS updating

<URL:> describes how to check out
-stable.  To get the -devel (HEAD) branch, omit `-r OPENLDAP_STABLE'.
You can use 'cvs status -v README' to get a list available CVS tags.

Core members should subscribe to the -core mailing list.  This
list is for private discussions between core team members.  The mailing list is the primary developer
forum for both  technical disscusions and coordinating efforts.

Please test patches before committing.  This should include compiling
and linking the system AND running the test suite.

In general, a patch/bugfix should be applied to -devel and tested.
When the patch is considered stable, then it can be merged into -stable.
Same goes for other release engineering branches (like
OPENLDAP_REL_ENG_1_1).  (-stable is rel eng 1.0).
Specific procjects may get their own branches, to be merged later.

Log messages: Just describe the change and reason.  CVS adds your name,
date, etc.

Various tips and hints

How to correct a CVS log message:
Commit the unchanged files again with the `-f' flag and with a log
message stating how the previous log was in error:
	cvs commit -f cldap.c os-ip.c
Preferably, prepend a line something like this to the message:
"Forced commit to correct previous log, files were not changed."

Modify ldapconfig.h instead of ldapconfig.h.edit.  Then `cvs commit'
from the include directory won't accidentally commit your private

© Copyright 2014-2020, OpenLDAP Foundation. Privacy Statement
$OpenLDAP: www/pages/devel/guidelines.wml,v 1.6 1999/10/13 21:06:16 kdz Exp $