]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
docs/CODING_STYLE: document that we nowadays prefer (const char*) for func ret type
authorMike Yuan <me@yhndnzj.com>
Tue, 2 Jul 2024 17:20:01 +0000 (19:20 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 2 Jul 2024 21:35:58 +0000 (23:35 +0200)
Addresses https://github.com/systemd/systemd/pull/33567#discussion_r1662818225

docs/CODING_STYLE.md

index 309436a397d88f8a3a659b1b019ebe0c061e8d1f..82ed0a553c69b6e0d4046cbf4d3d66393b7c308a 100644 (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
@@ -182,7 +194,7 @@ SPDX-License-Identifier: LGPL-2.1-or-later
 
   ```c
   static int foobar_frobnicate(
-                  Foobarobject,            /* the associated mutable object */
+                  Foobar *object,            /* the associated mutable object */
                   const char *input,         /* immutable input parameter */
                   char **ret_frobnicated,    /* return parameter on success */
                   unsigned *reterr_line,     /* return parameter on failure */