From: AtariDreams <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 9 Jan 2024 03:24:37 +0000 (-0500) Subject: cocci: merge mfree.cocci and mfree_return.cocci (#30838) X-Git-Tag: v256-rc1~1230 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=d7d6195953f44e5028341a13ff901fde424f7542;p=systemd%2F.git cocci: merge mfree.cocci and mfree_return.cocci (#30838) It makes sense that these should be one file instead of two, as they both involve mfree() --- diff --git a/coccinelle/mfree.cocci b/coccinelle/mfree.cocci index 191cd626f5..1062d0ca53 100644 --- a/coccinelle/mfree.cocci +++ b/coccinelle/mfree.cocci @@ -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 index c2c4cb3209..0000000000 --- a/coccinelle/mfree_return.cocci +++ /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);