summaryrefslogtreecommitdiff
path: root/CODING_STYLE
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2016-12-16 12:09:41 +0100
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:18:01 +0100
commit1cfc78c91965df340cdde100ad6cb3ed50b28927 (patch)
treeadc3d49b97131cd3e70edff05b14e9b67926e404 /CODING_STYLE
parent86e97d599f8b1ca379dce64fadac9b8f6b002ac5 (diff)
Prep v221: Update and clean up build system to sync with upstream
This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.
Diffstat (limited to 'CODING_STYLE')
-rw-r--r--CODING_STYLE28
1 files changed, 25 insertions, 3 deletions
diff --git a/CODING_STYLE b/CODING_STYLE
index 91f09e80a..dbadfbdb5 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -210,11 +210,12 @@
c) recvmsg() must get MSG_CMSG_CLOEXEC set
d) F_DUPFD_CLOEXEC should be used instead of F_DUPFD, and so on
-- We never use the XDG version of basename(). glibc defines it in
- libgen.h. The only reason to include that file is because dirname()
+- We never use the POSIX version of basename() (which glibc defines it in
+ libgen.h), only the GNU version (which glibc defines in string.h).
+ The only reason to include libgen.h is because dirname()
is needed. Everytime you need that please immediately undefine
basename(), and add a comment about it, so that no code ever ends up
- using the XDG version!
+ using the POSIX version!
- Use the bool type for booleans, not integers. One exception: in public
headers (i.e those in src/systemd/sd-*.h) use integers after all, as "bool"
@@ -292,3 +293,24 @@
- When returning a return code from main(), please preferably use
EXIT_FAILURE and EXIT_SUCCESS as defined by libc.
+
+- The order in which header files are included doesn't matter too
+ much. However, please try to include the headers of external
+ libraries first (these are all headers enclosed in <>), followed by
+ the headers of our own public headers (these are all headers
+ starting with "sd-"), internal utility libraries from src/shared/,
+ followed by the headers of the specific component. Or in other
+ words:
+
+ #include <stdio.h>
+ #include "sd-daemon.h"
+ #include "util.h"
+ #include "frobnicator.h"
+
+ Where stdio.h is a public glibc API, sd-daemon.h is a public API of
+ our own, util.h is a utility library header from src/shared, and
+ frobnicator.h is an placeholder name for any systemd component. The
+ benefit of following this ordering is that more local definitions
+ are always defined after more global ones. Thus, our local
+ definitions will never "leak" into the global header files, possibly
+ altering their effect due to #ifdeffery.