aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-10 13:24:23 -0800
committerJunio C Hamano <gitster@pobox.com>2017-03-10 13:24:23 -0800
commitfc32293502e86be2cabbe5e8e5863a2b657207b8 (patch)
tree87798ac7776dc9473d09f94ec45b96398cbc16b9 /contrib
parent82682e218a4ebe980345908c31ac9976f7ef4283 (diff)
parent33ad9ddd0b5398063f0aabea639b5fe569f458ea (diff)
downloadgit-fc32293502e86be2cabbe5e8e5863a2b657207b8.tar.gz
git-fc32293502e86be2cabbe5e8e5863a2b657207b8.tar.xz
Merge branch 'rs/strbuf-add-real-path'
An helper function to make it easier to append the result from real_path() to a strbuf has been added. * rs/strbuf-add-real-path: strbuf: add strbuf_add_real_path() cocci: use ALLOC_ARRAY
Diffstat (limited to 'contrib')
-rw-r--r--contrib/coccinelle/array.cocci16
-rw-r--r--contrib/coccinelle/strbuf.cocci6
2 files changed, 22 insertions, 0 deletions
diff --git a/contrib/coccinelle/array.cocci b/contrib/coccinelle/array.cocci
index 2d7f25d99..4ba98b7ea 100644
--- a/contrib/coccinelle/array.cocci
+++ b/contrib/coccinelle/array.cocci
@@ -24,3 +24,19 @@ expression n;
@@
- memcpy(dst, src, n * sizeof(T));
+ COPY_ARRAY(dst, src, n);
+
+@@
+type T;
+T *ptr;
+expression n;
+@@
+- ptr = xmalloc(n * sizeof(*ptr));
++ ALLOC_ARRAY(ptr, n);
+
+@@
+type T;
+T *ptr;
+expression n;
+@@
+- ptr = xmalloc(n * sizeof(T));
++ ALLOC_ARRAY(ptr, n);
diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci
index 63995f22f..1d580e49b 100644
--- a/contrib/coccinelle/strbuf.cocci
+++ b/contrib/coccinelle/strbuf.cocci
@@ -38,3 +38,9 @@ expression E1, E2, E3;
@@
- strbuf_addstr(E1, find_unique_abbrev(E2, E3));
+ strbuf_add_unique_abbrev(E1, E2, E3);
+
+@@
+expression E1, E2;
+@@
+- strbuf_addstr(E1, real_path(E2));
++ strbuf_add_real_path(E1, E2);