3 In order to keep the code nice and clean we have a few requirements you'll
4 need to stick to in order to get your patch accepted:
6 * Use GNU-style indentation:
15 * No braces for one line control clauses, except when another clause in the
16 chain contains more than one line:
24 // Use braces even though it's only one statement, because
25 // the condition is multiple lines long.
26 function_call_with_many_arguments (arg1, arg2, arg3,
31 // Use braces because the clause above did.
35 * Callback functions have a suffix _cb. TODO: ensure existing code follows this
38 * Use `char`/`int`/`double`/…, not `gchar`/`gint`/`gdouble`/… types, except
39 when implementing GLib vfuncs that use these types. TODO: ensure existing
40 code follows this rule.
42 * All implementation files must include first `"config.h"`, followed by
43 the primary header, followed by a blank line, followed by all the
44 local headers sorted alphabetically, followed by a blank line,
45 followed by all the system headers sorted alphabetically. Headers
46 should follow the same pattern excluding the config.h and
47 self file section, for obvious reasons. TODO: ensure existing code follows
50 * There's no space between a type cast and the variable name: Right:
51 `(int *)foo`. Wrong: `(int*) foo`.
53 * Avoid explicit comparisons against TRUE, FALSE, and NULL. Right:
54 `if (!condition)`, `if (!pointer)`, `if (integer == 0)`. Wrong:
55 `if (condition == FALSE)`, `if (pointer == NULL)`, `if (!integer)`.
56 Exception: `pointer != NULL` may be used to convert to gboolean since some
57 developers find this more natural than `!!pointer`.