[master] b8ee449f9 New replace.cocci semantic patch

Poul-Henning Kamp phk at FreeBSD.org
Mon Oct 21 11:56:06 UTC 2019


commit b8ee449f9331814bea23db78b79f33cecbe03178
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Oct 17 12:04:55 2019 +0200

    New replace.cocci semantic patch

diff --git a/tools/coccinelle/replace.cocci b/tools/coccinelle/replace.cocci
new file mode 100644
index 000000000..f70b7aeb8
--- /dev/null
+++ b/tools/coccinelle/replace.cocci
@@ -0,0 +1,12 @@
+/*
+ * This patch simplifies code using the REPLACE() macro.
+ */
+
+@@
+expression ptr, val;
+@@
+
+- free(ptr);
+- ptr = strdup(val);
+- AN(ptr);
++ REPLACE(ptr, val);


More information about the varnish-commit mailing list