]>
Commit | Line | Data |
---|---|---|
bcde9c0a VB |
1 | Coding standards |
2 | ---------------- | |
3 | ||
4 | Contributed code should roughly follow [OpenBSD style][1]. For Emacs, | |
5 | I am using the following snippet to get the appropriate indentation: | |
6 | ||
7 | (c-add-style | |
8 | "openbsd" | |
9 | '("bsd" | |
10 | (c-basic-offset . 8) | |
11 | (c-tab-width . 8) | |
12 | (fill-column . 80) | |
13 | (indent-tabs-mode . t) | |
14 | (c-offsets-alist . ((defun-block-intro . +) | |
15 | (statement-block-intro . +) | |
16 | (statement-case-intro . +) | |
17 | (statement-cont . *) | |
18 | (substatement-open . *) | |
19 | (substatement . +) | |
20 | (arglist-cont-nonempty . *) | |
21 | (inclass . +) | |
22 | (inextern-lang . 0) | |
23 | (knr-argdecl-intro . +))))) | |
24 | ||
25 | Important stuff is to use tabulations. Each tabulation has a width of | |
26 | 8 characters. This limits excessive nesting. Try to respect the 80 | |
27 | columns limit if possible. | |
28 | ||
29 | Opening braces are on the same line, except for functions where they | |
30 | are on their own lines. Closing braces are always on their own | |
31 | lives. Return type for functions are on their own lines too: | |
32 | ||
33 | int | |
34 | main(int argc, char *argv[]) | |
35 | { | |
36 | /* [...] */ | |
37 | } | |
38 | ||
39 | [1]: http://www.openbsd.org/cgi-bin/man.cgi?query=style&sektion=9 | |
40 | ||
41 | Submitting patches | |
42 | ------------------ | |
43 | ||
44 | Patches against git tip are preferred. Please, clone the repository: | |
45 | ||
46 | git clone https://github.com/vincentbernat/lldpd.git | |
47 | ||
48 | Do any modification you need. Commit the modifications with a | |
49 | meaningful message: | |
50 | ||
51 | 1. Use a descriptive first-line. | |
52 | ||
53 | 2. Prepend the first line with the name of the subsystem modified | |
54 | (`lldpd`, `lib`, `client`) or something a bit more precise. | |
55 | ||
56 | 3. Don't be afraid to put a lot of details in the commit message. | |
57 | ||
58 | Use `git format-patch` to get patches to submit: | |
59 | ||
60 | git format-patch origin/master | |
61 | ||
62 | Feel free to use `git send-email` which is like `git format-patch` but | |
63 | will propose to directly send patches by email. You can also open a | |
64 | [pull request][2] on Github. | |
65 | ||
66 | [2]: https://help.github.com/articles/using-pull-requests |