mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-06 04:50:12 +01:00
Add more rules to CODING_STYLE
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
1309718c00
commit
bc17221570
1 changed files with 26 additions and 0 deletions
26
CODING_STYLE
26
CODING_STYLE
|
|
@ -62,6 +62,26 @@
|
|||
useit(c);
|
||||
}
|
||||
|
||||
- do not mix function invocations and variable definitions.
|
||||
|
||||
wrong:
|
||||
|
||||
{
|
||||
int a = foo();
|
||||
int b = 7;
|
||||
}
|
||||
|
||||
right:
|
||||
{
|
||||
int a;
|
||||
int b = 7;
|
||||
|
||||
a = foo();
|
||||
}
|
||||
|
||||
There are exceptions here, e.g. tp_libinput_context(),
|
||||
litest_current_device()
|
||||
|
||||
- if/else: { on the same line, no curly braces if both blocks are a single
|
||||
statement. If either if or else block are multiple statements, both must
|
||||
have curly braces.
|
||||
|
|
@ -88,3 +108,9 @@
|
|||
#include <libevdev/libevdev.h>
|
||||
|
||||
#include "libinput-private.h"
|
||||
|
||||
- goto jumps only to the end of the function, and only for good reasons
|
||||
(usually cleanup). goto never jumps backwards
|
||||
|
||||
- Use stdbool.h's bool for booleans within the library (instead of 'int').
|
||||
Exception: the public API uses int, not bool.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue