summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-27 19:16:47 +0100
committerLennart Poettering <lennart@poettering.net>2018-03-02 12:39:07 +0100
commit8419d4577641e519a49883cc80360bc348db2825 (patch)
tree94dec604fb1efdcf81acd561ff32216b7e6fb544 /coccinelle
parent62d74c78b59f95a76778d9fa8dbe3b098afa2aad (diff)
coccinelle: similar to reallocarray() let's also systematically use malloc_multiply()
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/malloc_multiply.cocci20
1 files changed, 20 insertions, 0 deletions
diff --git a/coccinelle/malloc_multiply.cocci b/coccinelle/malloc_multiply.cocci
new file mode 100644
index 0000000000..3284edf737
--- /dev/null
+++ b/coccinelle/malloc_multiply.cocci
@@ -0,0 +1,20 @@
+@@
+expression q, n, m;
+@@
+- q = malloc((n)*(m))
++ q = malloc_multiply(n, m)
+@@
+expression q, n, m;
+@@
+- q = malloc(n*(m))
++ q = malloc_multiply(n, m)
+@@
+expression q, n, m;
+@@
+- q = malloc((n)*m)
++ q = malloc_multiply(n, m)
+@@
+expression q, n, m;
+@@
+- q = malloc(n*m)
++ q = malloc_multiply(n, m)