summaryrefslogtreecommitdiffstats
path: root/coccinelle/empty-if.cocci
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-08 23:03:38 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 08:20:20 +0200
commitece174c5439021e32ebcc858842de9586072c006 (patch)
treeb469235d6c4b195a6b53c7c5d97c0e516bfb4bc6 /coccinelle/empty-if.cocci
parenttree-wide: make use of log_error_errno() return value (diff)
downloadsystemd-ece174c5439021e32ebcc858842de9586072c006.tar.xz
systemd-ece174c5439021e32ebcc858842de9586072c006.zip
tree-wide: drop {} from one-line if blocks
Patch via coccinelle.
Diffstat (limited to 'coccinelle/empty-if.cocci')
-rw-r--r--coccinelle/empty-if.cocci19
1 files changed, 19 insertions, 0 deletions
diff --git a/coccinelle/empty-if.cocci b/coccinelle/empty-if.cocci
new file mode 100644
index 0000000000..ebd0bfddce
--- /dev/null
+++ b/coccinelle/empty-if.cocci
@@ -0,0 +1,19 @@
+@@
+expression e, f;
+statement s, t;
+@@
+(
+if (e) {
+if (f) s
+}
+|
+if (e) {
+if (f) s
+else t
+}
+|
+- if (e) {
++ if (e)
+s
+- }
+)