annotate mcabber/CodingStyle.txt @ 2225:dc3b3ac1ba76

Free the buffdata structures when buffers are closed Free the buffdata strcutures when buffers are closed and there are no more users (these structures can be shared if the "symlink" shared history is used).
author Mikael Berthe <mikael@lilotux.net>
date Sat, 07 Nov 2015 12:21:12 +0100
parents 189ffdd944b4
children ffd0e57e9563
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1509
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
1 This document describes the preferred coding style for the mcabber project.
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
2
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
3 If you intend to patch and contribute to mcabber, please try to use the
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
4 existing style, and read the following points.
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
5
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
6 - Do not use tabs, use space characters;
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
7 - Avoid trailing whitespace;
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
8 - Avoid lines longer than 80 characters;
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
9 - Indentation is 2 spaces (ok, maybe it isn't a good idea but it's the
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
10 current style);
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
11 - Put a space after non-functions statements (e.g. if, while...)
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
12 - Put the opening brace last on the same line, and put the closing brace first
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
13 except for functions, where the opening brace should be alone on a new line.
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
14
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
15 Example:
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
16
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
17 void example(void)
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
18 {
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
19 if (cond1) {
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
20 do_a();
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
21 } else if (cond2) {
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
22 do_b();
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
23 } else {
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
24 do_c();
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
25 }
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
26
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
27 if (error)
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
28 exit(0);
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
29 }
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
30
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
31 - Look at existing code for rules not mentioned here.
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
32
189ffdd944b4 Add a small Coding Style document
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
33 Mikael