1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-10 00:58:20 +03:00

docs/CODING_STYLE: document that we nowadays prefer (const char*) for func ret type

Addresses https://github.com/systemd/systemd/pull/33567#discussion_r1662818225

(cherry picked from commit 4b7249111a4c1d366f476bdbd6e03f7893eb9d42)
(cherry picked from commit 3c91ea49d249cda6e1fa84b53a42dee6d83339da)
(cherry picked from commit b8d993f0292f25cddbc284acb4ddc513cf0d1f3b)
(cherry picked from commit 661fa2d832baffd03f0adbb749f1a8a3bbae1979)
This commit is contained in:
Mike Yuan 2024-07-02 19:20:01 +02:00 committed by Luca Boccassi
parent 03c639bcda
commit dfd7f210d3

View File

@ -54,6 +54,18 @@ SPDX-License-Identifier: LGPL-2.1-or-later
}
```
- Function return types should be seen/written as whole, i.e. write this:
```c
const char* foo(const char *input);
```
instead of this:
```c
const char *foo(const char *input);
```
- Single-line `if` blocks should not be enclosed in `{}`. Write this:
```c
@ -179,7 +191,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
```c
static int foobar_frobnicate(
Foobar* object, /* the associated mutable object */
Foobar *object, /* the associated mutable object */
const char *input, /* immutable input parameter */
char **ret_frobnicated) { /* return parameter */