summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-20 20:36:09 +0100
committerLennart Poettering <lennart@poettering.net>2018-03-20 20:59:02 +0100
commitbe6b0c21654e1c587cb942d464281bcc89ef4ddf (patch)
tree64ae8adf2baaabbcd146402e098c0760a0e9c7ac /coccinelle
parent3ceae1bc14d2da3fc1fe4753d6657759012256dc (diff)
downloadsystemd-be6b0c21654e1c587cb942d464281bcc89ef4ddf.tar.gz
coccinelle: make use of DIV_ROUND_UP() wherever appropriate
Let's use our macros where we can
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/div-round-up.cocci20
1 files changed, 20 insertions, 0 deletions
diff --git a/coccinelle/div-round-up.cocci b/coccinelle/div-round-up.cocci
new file mode 100644
index 0000000000..a0c6df9801
--- /dev/null
+++ b/coccinelle/div-round-up.cocci
@@ -0,0 +1,20 @@
+@@
+expression x, y;
+@@
+- ((x + y - 1) / y)
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- ((x + (y - 1)) / y)
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- (x + y - 1) / y
++ DIV_ROUND_UP(x, y)
+@@
+expression x, y;
+@@
+- (x + (y - 1)) / y
++ DIV_ROUND_UP(x, y)