]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
coccinelle: properly drop braces around single-statement if()s
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 10:43:27 +0000 (11:43 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 25 Dec 2023 12:53:02 +0000 (13:53 +0100)
coccinelle/zz-drop-braces.cocci

index 8c3be01c1f78617e3a655b0c1acd5046cc241794..7a3382c9a7b9e2f13f54d64b7bbad7bb9b95cdf1 100644 (file)
@@ -1,28 +1,13 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 @@
 position p : script:python() { p[0].file != "src/journal/lookup3.c" };
-identifier id;
-expression e;
+expression e,e1;
 @@
-if (...)
-- {
+- if (e) {
++ if (e)
 (
-    id@p(...);
+  e1@p;
 |
-    e@p;
-)
-- }
-
-@@
-position p : script:python() { p[0].file != "src/journal/lookup3.c" };
-identifier id;
-expression e;
-@@
-if (...)
-- {
-(
-    return id@p(...);
-|
-    return e@p;
+  return e1@p;
 )
 - }