]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - CODING_STYLE
core: s/reexection/reexecution/ typo fix
[thirdparty/systemd.git] / CODING_STYLE
index bdec988ce6bdbca0f9155bb57cb28577b2190a6c..a96ddd35980fd11aa2cf81edfee01f77d1f1a496 100644 (file)
   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"
   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.
+
+- To implement an endless loop, use "for (;;)" rather than "while
+  (1)". The latter is a bit ugly anyway, since you probably really
+  meant "while (true)"... To avoid the discussion what the right
+  always-true expression for an infinite while() loop is our
+  recommendation is to simply write it without any such expression by
+  using "for (;;)".