diff mbox series

[03/88] cocci: extract typeof() from g_new()

Message ID 20171006235023.11952-4-f4bug@amsat.org
State New
Headers show
Series use g_new() family of functions | expand

Commit Message

Philippe Mathieu-Daudé Oct. 6, 2017, 11:48 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scripts/coccinelle/g_new.cocci | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/scripts/coccinelle/g_new.cocci b/scripts/coccinelle/g_new.cocci
index c767325a21..368f0c5651 100644
--- a/scripts/coccinelle/g_new.cocci
+++ b/scripts/coccinelle/g_new.cocci
@@ -118,6 +118,15 @@  T *m;
 +m = g_try_new0(T, 1);
 )
 
+@@
+type T;
+identifier m;
+@@
+T **m;
+...
+- *m = g_malloc0(sizeof(**m));
++ *m = g_new0(T *, 1);
+
 ////////////////////////////////////////
 //
 // last transformations: cleanups