From: Frantisek Sumsal Date: Mon, 25 Dec 2023 10:43:27 +0000 (+0100) Subject: coccinelle: properly drop braces around single-statement if()s X-Git-Tag: v256-rc1~1384^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcd2db31c03e717d9f3b66f52af06ce60de46add;p=thirdparty%2Fsystemd.git coccinelle: properly drop braces around single-statement if()s --- diff --git a/coccinelle/zz-drop-braces.cocci b/coccinelle/zz-drop-braces.cocci index 8c3be01c1f7..7a3382c9a7b 100644 --- a/coccinelle/zz-drop-braces.cocci +++ b/coccinelle/zz-drop-braces.cocci @@ -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; ) - }