qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 03/88] cocci: extract typeof() from g_new()


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH 03/88] cocci: extract typeof() from g_new()
Date: Fri, 6 Oct 2017 20:48:58 -0300

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 scripts/coccinelle/g_new.cocci | 9 +++++++++
 1 file changed, 9 insertions(+)

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
-- 
2.14.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]