]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cocci: merge mfree.cocci and mfree_return.cocci (#30838)
authorAtariDreams <83477269+AtariDreams@users.noreply.github.com>
Tue, 9 Jan 2024 03:24:37 +0000 (22:24 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 03:24:37 +0000 (12:24 +0900)
It makes sense that these should be one file instead of two, as they both involve mfree()

coccinelle/mfree.cocci
coccinelle/mfree_return.cocci [deleted file]

index 191cd626f52a49709111347d4e039810d532f2cb..1062d0ca53707a082654167509b53a5fef4b5603 100644 (file)
@@ -1,7 +1,36 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
+@@
+/* Avoid running this transformation on the mfree function itself */
+position p : script:python() { p[0].current_element != "mfree" };
+expression e;
+@@
+- free@p(e);
+- return NULL;
++ return mfree(e);
+
 @@
 expression p;
 @@
 - free(p);
 - p = NULL;
 + p = mfree(p);
+
+@@
+expression p;
+@@
+- if (p)
+-          free(p);
++ free(p);
+
+@@
+expression p;
+@@
+- if (p)
+-          mfree(p);
++ free(p);
+
+@@
+expression p;
+@@
+- mfree(p);
++ free(p);
diff --git a/coccinelle/mfree_return.cocci b/coccinelle/mfree_return.cocci
deleted file mode 100644 (file)
index c2c4cb3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-@@
-/* Avoid running this transformation on the mfree function itself */
-position p : script:python() { p[0].current_element != "mfree" };
-expression e;
-@@
-- free@p(e);
-- return NULL;
-+ return mfree(e);