### Include Order Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Specifies the order for include directives: first "config.h", then system headers, followed by external library headers, and finally internal headers. System headers should be sorted alphabetically. ```c #include "config.h" #include #include #include #include "libevdev-int.h" ``` -------------------------------- ### Line Breaking for Long Lines Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Demonstrates how to break up long lines at logical groupings. Each logical group should be on its own line. ```c int a = somelongname() + someotherlongname(); if (a < 0 && (b > 20 & d < 10) && d != 0.0) somelongfunctioncall(arg1, arg2, otherarg); ``` -------------------------------- ### Configure Git User Name and Email Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Set your real name and email address globally for Git commits. This is required for the Signed-off-by line. ```bash git config --global user.name Your Name git config --global user.email your@email ``` -------------------------------- ### Standard Git Commit Message Format Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Follow this structure for your commit messages: a concise subject line, a detailed explanation, and the signed-off-by line. ```git one line as the subject line with a high-level note full explanation of the patch follows after an empty line. This explanation can be multiple paragraphs and is largely free-form. Markdown is not supported. You can include extra data where required like: - benchmark one says 10s - benchmark two says 12s Signed-off-by: ``` -------------------------------- ### Function Declaration Formatting Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Specifies the formatting for function declarations, with the return type on a separate line, curly braces on a separate line, and arguments broken up logically. ```c static inline int foobar(int a, int b) { } void somenamethatiswaytoolong(int a, int b, int other) { } ``` -------------------------------- ### Variable Declaration Placement Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Variables should be declared at the top of a block and kept as local as possible. Exceptions are made for variables reused across multiple blocks or for basic loop variables. ```c int a; int c; if (foo) { int b; c = get_value(); usevalue(c); } if (bar) { c = get_value(); useit(c); } ``` -------------------------------- ### Variable Definition and Function Invocation Separation Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Avoid mixing function invocations with variable definitions in the same block. Define variables first, then invoke functions. ```c { int a; int b = 7; a = foo(); } ``` -------------------------------- ### Developer Certificate of Origin Signature Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md Append this line to your commit message to certify the origin of your contribution. ```git Signed-off-by: ``` -------------------------------- ### If/Else Block Formatting Source: https://github.com/libevdev/libevdev/blob/master/CODING_STYLE.md For if/else statements, the opening curly brace should be on the same line. Curly braces are optional if both the if and else blocks contain a single statement. If either block contains multiple statements, both must have curly braces. ```c if (foo) { blah(); bar(); } else { a = 10; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.