]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - coccinelle/take-ptr.cocci
macro: introduce TAKE_PTR() macro
[thirdparty/systemd.git] / coccinelle / take-ptr.cocci
diff --git a/coccinelle/take-ptr.cocci b/coccinelle/take-ptr.cocci
new file mode 100644 (file)
index 0000000..0cebe81
--- /dev/null
@@ -0,0 +1,14 @@
+@@
+local idexpression p;
+expression q;
+@@
+- p = q;
+- q = NULL;
+- return p;
++ return TAKE_PTR(q);
+@@
+expression p, q;
+@@
+- p = q;
+- q = NULL;
++ p = TAKE_PTR(q);