mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
coccinelle: add reallocarray() coccinelle script
Let's systematically make use of reallocarray() whereever we invoke realloc() with a product of two values.
This commit is contained in:
20
coccinelle/reallocarray.cocci
Normal file
20
coccinelle/reallocarray.cocci
Normal file
@@ -0,0 +1,20 @@
|
||||
@@
|
||||
expression q, p, n, m;
|
||||
@@
|
||||
- q = realloc(p, (n)*(m))
|
||||
+ q = reallocarray(p, n, m)
|
||||
@@
|
||||
expression q, p, n, m;
|
||||
@@
|
||||
- q = realloc(p, n*(m))
|
||||
+ q = reallocarray(p, n, m)
|
||||
@@
|
||||
expression q, p, n, m;
|
||||
@@
|
||||
- q = realloc(p, (n)*m)
|
||||
+ q = reallocarray(p, n, m)
|
||||
@@
|
||||
expression q, p, n, m;
|
||||
@@
|
||||
- q = realloc(p, n*m)
|
||||
+ q = reallocarray(p, n, m)
|
||||
Reference in New Issue
Block a user