summaryrefslogtreecommitdiff
path: root/CODING_STYLE
AgeCommit message (Collapse)Author
2016-12-01tree-wide: set SA_RESTART for signal handlers we installLennart Poettering
We already set it in most cases, but make sure to set it in all others too, and document that that's a good idea.
2016-07-25CODING_STYLE fixes (#3804)Lennart Poettering
As noted by @evverx: https://github.com/systemd/systemd/pull/3802/files/0b81133facb7576e983ec8427ffc3a4a8cc62846#r72126018 https://github.com/systemd/systemd/pull/3802/files/0b81133facb7576e983ec8427ffc3a4a8cc62846#r72126432
2016-07-25CODING_STYLE: document src/shared ←→ src/basic splitLennart Poettering
Addresses: https://github.com/systemd/systemd/pull/3580#issuecomment-227931168 While we are at it, also document that we focus on glibc, not any other libcs.
2016-06-15tree-wide: htonl() is weird, let's use htobe32() instead (#3538)Lennart Poettering
Super-important change, yeah!
2016-06-06Two CODING_STYLE additionsLennart Poettering
2016-05-02minor CODING_STYLE clarificationLennart Poettering
2016-04-12update CODING_STYLE a bitLennart Poettering
2016-02-24treewide: fix typos and then/that useTorstein Husebø
2016-01-25CODING_STYLE: make sure line break recommendation matches edit configurationLennart Poettering
In the .vimrc and .dir-locals.el we suggest a line width of 119. We should recommend the same in CODING_STYLE.
2015-11-10CODING_STYLE: elaborate on usage of C99 fixed size integer typesLennart Poettering
2015-10-19update CODING_STYLELennart Poettering
2015-10-08update CODING_STYLELennart Poettering
2015-10-06update CODING_STYLELennart Poettering
2015-10-01update CODING_STYLE with various additionsLennart Poettering
2015-09-10tree-wide: never use the off_t unless glibc makes us use itLennart Poettering
off_t is a really weird type as it is usually 64bit these days (at least in sane programs), but could theoretically be 32bit. We don't support off_t as 32bit builds though, but still constantly deal with safely converting from off_t to other types and back for no point. Hence, never use the type anymore. Always use uint64_t instead. This has various benefits, including that we can expose these values directly as D-Bus properties, and also that the values parse the same in all cases.
2015-09-05CODING_STYLE: mandate alphabetical include orderDavid Herrmann
systemd-internal headers must not rely on include order. That means, they either must contain forward-declarations of used types/functions, or they must include all dependencies on their own. Therefore, there is no reason to mandate an include order on the call-side. However, global includes should always be ordered first. We don't want local definitions to leak into global includes, possible changing their behavior. Apparently, namespacing is a complex problem that people are incapable of implementing properly.. Apart from "global before local", there is no reason to mandate a random include order (which we happen to do right now). Instead, mandate alphabetical ordering. The current rules do not have any benefit at all. They neither reduce include-complexity, nor allow easy auditing of include files. But with alphabetical ordering, we get duplicate-detection for free, it gets *much much* easier to figure out whether a header is already included, and it is trivial to add new headers.
2015-07-31CODING_STYLE: say that "for (;;)" is better than "while (1)"Lennart Poettering
2015-06-17Stop talking about the "XDG" version of basename()Simon McVittie
XDG refers to X Desktop Group, a former name for freedesktop.org. This group is responsible for specifications like basedirs, .desktop files and icon naming, but as far as I know, it has never tried to redefine basename(). I think these references were meant to say XPG (X/Open Portability Guide), a precursor of POSIX. POSIX is better-known and less easily confused with XDG, and is how the basename(3) man page describes the libgen.h version of basename(). The other version of basename() is glibc-specific and is described in basename(3) as "the GNU version"; specifically mention that version, to disambiguate.
2015-05-29CODING_STYLE: document order in which to #include headersLennart Poettering
2015-05-18CODING_STYLE: document that we should avoid kernel types like u32Lennart Poettering
2015-05-15CODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be usedLennart Poettering
2015-05-15CODING_STYLE: document best practices when initializing structsLennart Poettering
2015-05-15CODING_STYLE: document alloca() DONTSLennart Poettering
2015-04-22CODING_STYLE: document that we prefer /* comments */ over // commentsLennart Poettering
2015-04-21CODING_STYLE: document how destructors should workLennart Poettering
2015-04-03CODING_STYLE: mention that dup() should not be usedLennart Poettering
2015-04-02CODING_STYLE: clarify that exit() is never OK to callLennart Poettering
2015-03-10CODING_STYLE: mention casting of function invocations to (void)Lennart Poettering
2015-02-28update TODOLennart Poettering
2015-02-11tree-wide: whenever we include libgen.h, immediately undefine basename()Lennart Poettering
Also, document in adjacent comments and in CODING_STYLE why we do that.
2015-02-10CODING_STYLE: elaborate on O_CLOEXEC a bitLennart Poettering
2015-02-03Reindent man pages to 2chZbigniew Jędrzejewski-Szmek
2014-10-30CODING_STYLE: clarify that we really should use O_CLOEXEC everywhereLennart Poettering
2014-10-27CODING_STYLE: don't clobber arguments on failureLennart Poettering
2014-10-22CODING_STYLE: clarify that single-line if blocks should not be enclosed in {}Lennart Poettering
2014-08-30Fix a few more typosRuben Kerkhof
2014-08-21CODING_STYLE: document that we don't break lines at 80chLennart Poettering
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-06-28doc: use expanded forms for written styleJan Engelhardt
2014-06-28doc: typographical improvements and choice of wordsJan Engelhardt
2014-06-28doc: grammatical correctionsJan Engelhardt
2014-05-24Fix several small typosJonathan Boulle
2013-12-09extend CODING_STYLE document a bitLennart Poettering
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-03-08analyze: various cleanupsLennart Poettering
Update systemd-analyze to follow the coding style of the other tools more closely. Also, update the CODING_STYLE to document this for future additions. Changes: - Always use usec_t for time units, so that we always use the same types everywhere, and format times the same way as everywhere else. - Add "static" to global variables - Make sure we can always distuingish OOM and other errors: ensure we always return useful error codes from all functions. - Always free unit_times array
2013-01-29Clarify sentenceTollef Fog Heen
2012-10-01Minor typoTollef Fog Heen
2012-10-01Be consistent about "." vs no "." at the end of lines"Tollef Fog Heen
2011-02-28Spelling CorrectionsHarald Hoyer
Just some lame spelling corrections with no functionality.
2010-02-14CODING_STYLE: minor updatesLennart Poettering