about summary refs log tree commit diff
path: root/third_party/git/contrib/coccinelle/xstrdup_or_null.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/contrib/coccinelle/xstrdup_or_null.cocci')
-rw-r--r--third_party/git/contrib/coccinelle/xstrdup_or_null.cocci13
1 files changed, 13 insertions, 0 deletions
diff --git a/third_party/git/contrib/coccinelle/xstrdup_or_null.cocci b/third_party/git/contrib/coccinelle/xstrdup_or_null.cocci
new file mode 100644
index 000000000000..8e05d1ca4b61
--- /dev/null
+++ b/third_party/git/contrib/coccinelle/xstrdup_or_null.cocci
@@ -0,0 +1,13 @@
+@@
+expression E;
+expression V;
+@@
+- if (E)
+-    V = xstrdup(E);
++ V = xstrdup_or_null(E);
+
+@@
+expression E;
+@@
+- xstrdup(absolute_path(E))
++ absolute_pathdup(E)