Skip to content

Commit 1aaa6d8

Browse files
committed
style: add .clang-format and reformat source
1 parent 5a4ba02 commit 1aaa6d8

6 files changed

Lines changed: 244 additions & 208 deletions

File tree

.clang-format

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
2+
AllowShortBlocksOnASingleLine: false
3+
AllowShortFunctionsOnASingleLine: Empty
4+
AllowShortIfStatementsOnASingleLine: Never
5+
AllowShortLambdasOnASingleLine: Empty
6+
AllowShortLoopsOnASingleLine: false
7+
AlwaysBreakTemplateDeclarations: Yes
8+
BreakBeforeTernaryOperators: false
9+
BreakBeforeBraces: Custom
10+
BraceWrapping:
11+
AfterFunction: true
12+
ColumnLimit: 120
13+
ForEachMacros:
14+
[
15+
hashmap_foreach,
16+
hashmap_foreach_safe,
17+
hashmap_foreach_key,
18+
hashmap_foreach_key_safe,
19+
hashmap_foreach_data,
20+
hashmap_foreach_data_safe,
21+
]
22+
IndentWidth: 4
23+
InsertBraces: true
24+
KeepEmptyLinesAtTheStartOfBlocks: false
25+
WhitespaceSensitiveMacros: [hashmap_*]
26+
SpaceBeforeParens: ControlStatementsExceptForEachMacros

examples/hashmap_example.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* it under the terms of the MIT license. See LICENSE for details.
66
*/
77

8-
#include <stdlib.h>
8+
#include <errno.h>
99
#include <stdbool.h>
1010
#include <stdio.h>
11+
#include <stdlib.h>
1112
#include <string.h>
12-
#include <errno.h>
1313

1414
#include <hashmap.h>
1515

@@ -95,4 +95,3 @@ int main(int argc, char **argv)
9595

9696
return 0;
9797
}
98-

0 commit comments

Comments
 (0)