Hash :
6533aadc
Author :
Date :
2008-10-31T18:23:01
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
libgit2 conventions
===================
Namespace Prefixes
------------------
All types and functions start with 'git_'.
All #define macros start with 'GIT_'.
Type Definitions
----------------
Most types should be opaque, e.g.:
----
typedef struct git_odb git_odb;
----
with allocation functions returning an "instance" created within
the library, and not within the application. This allows the type
to grow (or shrink) in size without rebuilding client code.
Public Exported Function Definitions
------------------------------------
All exported functions must be declared as:
----
GIT_EXTERN(result_type) git_modulename_functionname(arg_list);
----
Semi-Private Exported Functions
-------------------------------
Functions whose modulename is followed by two underscores,
for example 'git_odb__read_packed', are semi-private functions.
They are primarily intended for use within the library itself,
and may disappear or change their signature in a future release.
Calling Conventions
-------------------
Functions should prefer to return a 'int' to indicate success or
failure and supply any output through the first argument (or first
few arguments if multiple outputs are supplied).
int status codes are 0 for GIT_SUCCESS and < 0 for an error.
This permits common POSIX result testing:
----
if (git_odb_open(&odb, path))
abort("odb open failed");
----
Documentation Fomatting
-----------------------
All comments should conform to Doxygen "javadoc" style conventions
for formatting the public API documentation.
Public Header Format
--------------------
All public headers defining types, functions or macros must use
the following form, where ${filename} is the name of the file,
after replacing non-identifier characters with '_'.
----
#ifndef INCLUDE_${filename}_h__
#define INCLUDE_${filename}_h__
#include "git_common.h"
/**
* @file ${filename}.h
* @brief Git some description
* @defgroup ${filename} some description routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
... definitions ...
/** @} */
GIT_END_DECL
#endif
----