1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-27 07:22:31 +03:00
Commit Graph

37 Commits

Author SHA1 Message Date
David Herrmann
54c1f2d761 CODING_STYLE: mandate alphabetical include order
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-09-05 18:24:26 +02:00
Lennart Poettering
cad6982291 CODING_STYLE: say that "for (;;)" is better than "while (1)" 2015-07-31 20:00:07 +02:00
Simon McVittie
11c9f1e48a Stop talking about the "XDG" version of basename()
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-06-17 11:23:46 +01:00
Lennart Poettering
1811232c4c CODING_STYLE: document order in which to #include headers 2015-05-29 20:12:17 +02:00
Lennart Poettering
8cb1cc8dc3 CODING_STYLE: document that we should avoid kernel types like u32 2015-05-18 18:47:52 +02:00
Lennart Poettering
0fef704c6f CODING_STYLE: document that EXIT_FAILURE and EXIT_SUCCESS should be used 2015-05-15 21:34:14 +02:00
Lennart Poettering
a5ecb0cec2 CODING_STYLE: document best practices when initializing structs 2015-05-15 21:06:40 +02:00
Lennart Poettering
42706f47c9 CODING_STYLE: document alloca() DONTS 2015-05-15 15:47:37 +02:00
Lennart Poettering
2708526c4a CODING_STYLE: document that we prefer /* comments */ over // comments 2015-04-22 22:56:24 +02:00
Lennart Poettering
ba780c116f CODING_STYLE: document how destructors should work 2015-04-21 00:58:56 +02:00
Lennart Poettering
9ff3e22aa9 CODING_STYLE: mention that dup() should not be used 2015-04-03 14:26:22 +02:00
Lennart Poettering
3dbafa39b0 CODING_STYLE: clarify that exit() is never OK to call 2015-04-02 12:17:41 +02:00
Lennart Poettering
918315e457 CODING_STYLE: mention casting of function invocations to (void) 2015-03-10 17:39:42 +01:00
Lennart Poettering
ddb64d8270 update TODO 2015-02-28 17:38:38 +01:00
Lennart Poettering
eef46c372f tree-wide: whenever we include libgen.h, immediately undefine basename()
Also, document in adjacent comments and in CODING_STYLE why we do that.
2015-02-11 18:50:38 +01:00
Lennart Poettering
699eee62d1 CODING_STYLE: elaborate on O_CLOEXEC a bit 2015-02-10 21:25:38 +01:00
Zbigniew Jędrzejewski-Szmek
798d3a524e Reindent man pages to 2ch 2015-02-03 23:11:35 -05:00
Lennart Poettering
dd4540da0e CODING_STYLE: clarify that we really should use O_CLOEXEC everywhere 2014-10-30 17:05:25 +01:00
Lennart Poettering
7f8bf08f90 CODING_STYLE: don't clobber arguments on failure 2014-10-27 18:09:26 +01:00
Lennart Poettering
61f33134fc CODING_STYLE: clarify that single-line if blocks should not be enclosed in {} 2014-10-22 11:45:12 +02:00
Ruben Kerkhof
06b643e7f5 Fix a few more typos 2014-08-30 13:46:07 -04:00
Lennart Poettering
3fdbc82058 CODING_STYLE: document that we don't break lines at 80ch 2014-08-21 17:24:21 +02:00
Zbigniew Jędrzejewski-Szmek
601185b43d Unify parse_argv style
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-08-03 21:46:07 -04:00
Jan Engelhardt
8e5edf8d42 doc: use expanded forms for written style 2014-06-28 00:06:31 -04:00
Jan Engelhardt
45df8656eb doc: typographical improvements and choice of words 2014-06-28 00:06:31 -04:00
Jan Engelhardt
8d0e0ddda6 doc: grammatical corrections 2014-06-28 00:06:30 -04:00
Jonathan Boulle
865cc19a34 Fix several small typos 2014-05-24 19:01:03 -04:00
Lennart Poettering
d3a485135a extend CODING_STYLE document a bit 2013-12-09 23:04:05 +01:00
Thomas Hindoe Paaboel Andersen
f168c27313 trivial coding style clean ups
- 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-12-03 22:27:45 +01:00
Lennart Poettering
c170f3a41b analyze: various cleanups
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-03-08 18:58:08 +01:00
Tollef Fog Heen
01233fc712 Clarify sentence 2013-01-29 17:57:16 +01:00
Tollef Fog Heen
ee7326a636 Minor typo 2012-10-01 21:48:15 +02:00
Tollef Fog Heen
f49f49ba13 Be consistent about "." vs no "." at the end of lines" 2012-10-01 21:40:58 +02:00
Harald Hoyer
35b8ca3aaf Spelling Corrections
Just some lame spelling corrections with no functionality.
2011-02-28 22:47:38 +01:00
Lennart Poettering
debf93a4d6 CODING_STYLE: minor updates 2010-02-14 22:44:51 +01:00
Lennart Poettering
e1cc7a01bb CODING_STYLE: add missing - 2009-11-18 14:32:23 +01:00
Lennart Poettering
6091827530 initial commit 2009-11-18 00:42:52 +01:00