Skip to content

Commit

Permalink
Update code syle documentation
Browse files Browse the repository at this point in the history
Add details for if statement bracket use and function and variable
names.
  • Loading branch information
bryteise committed Oct 31, 2017
1 parent c025f71 commit aba771b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions HACKING
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Hacking clr-boot-manager
----------------------

clr-boot-manager makes use of clang-format and a .clang-format configuration
file found in the source root in order to validate changes conform to most of
the style rules around spacing and indentation.

Indentation is strictly 8 spaces (set tab stops to 8 spaces) - No tabs
No spaces between function name and parentheses. Only use space after
"if (", etc.
Expand Down Expand Up @@ -32,11 +36,14 @@ looking back through the file.

Use consistent pointers! "*" should prefix your variable name. Also ensure
your pointers (where appropriate) are not left uninitialized, resulting
in broken g_free() calls.
in broken free() calls.

Variable and function names are lower case and functions should be fully
spelled out words. Use '_' to split words in variables and functions.

Acceptable:
char *something = NULL;
doFunc(&something);
do_function(&something);

Unacceptable:
char* something;
Expand All @@ -45,6 +52,9 @@ Unacceptable:
Minimise your use of "goto"'s, and test every code path is reached. Also
ensure *every* if/else, etc, even if single line, is wrapped in curly braces.

All conditional statements (if, if-else, while, do-while) should always use
brackets regardless of the number of lines in the consequent blocks.

Memory management:
------------------
clr-boot-manager prefers a scope-based approach to memory management,
Expand Down

0 comments on commit aba771b

Please sign in to comment.