[Ver-0.8.1] Add error checking code
[platform/core/uifw/libtpl-egl.git] / coding_guide.txt
1 1. Function names
2         1) all internal function names should start with '__tpl'
3         2) externally exposed function names should start with 'tpl'
4
5 2. Input argument checking
6         1) internal functions should TPL_ASSERT on non-null for all pointer type
7            argumentxs
8                 Exception:
9                 - NULL is valid value
10                 - function is a validity checking function
11         2) internal functions should not check for non-null for pointer type
12            arguments with conditional branching
13                 Execption: function is a validity checking function
14         3) externally exposed functions should check for non-null for all
15            pointer type arguments with 'if' statement
16                 Execption: NULL is valid value
17         4) when externally exposed function is return due to error, TPL_ERR
18            should be called with appropriate error message
19
20 3. Function calling
21         1) before calling internal function, caller function *MUST* check for
22            value validity before passing it to the callee
23            (internal functions do not check for input validity)
24
25 4. Return value
26         1) functions should return a value
27                 Exception:
28                 - failure is ignorable
29                 - failure not possible
30         2) default return values should be TPL_TRUE on success and TPL_FALSE on
31            failure
32         3) functions that return pointer value *MUST* return NULL on error
33         4) other functions which return values useful to other callee may return
34            that value
35
36 5. Documentation
37         1) *ALL* functions in libtpl-egl *MUST* be documented in Doxygen format
38         2) functions *MUST* have at least brief, param, and return sections
39
40 6. Enumeration type
41         1) *ALL* enums *MUST* start with error code, 'xxx_ERROR' and assigned
42            value of -1
43         2) *ALL* enums *MUST* have identifier named 'xxx_MAX' to signify the end
44            of the enum list (i.e. 'TPL_OBJECT_MAX')