Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-04-04 01:00:06 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-04 12:22:30 +0300
commit0cf2b0a04bb9b48fb0d91f47ce5fd2ea436112c8 (patch)
treeff9b05a94bd455c1328d0d48fe117330d306b6de /contrib
parent577314caae2635986aa30a83ed956c8741d27ffb (diff)
cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR
Ensure that a FLEX_MALLOC_MEM that uses 'strlen' for its 'len' uses FLEX_ALLOC_STR instead, since these are equivalent forms. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/coccinelle/flex_alloc.cocci13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/coccinelle/flex_alloc.cocci b/contrib/coccinelle/flex_alloc.cocci
new file mode 100644
index 0000000000..e9f7f6d861
--- /dev/null
+++ b/contrib/coccinelle/flex_alloc.cocci
@@ -0,0 +1,13 @@
+@@
+expression str;
+identifier x, flexname;
+@@
+- FLEX_ALLOC_MEM(x, flexname, str, strlen(str));
++ FLEX_ALLOC_STR(x, flexname, str);
+
+@@
+expression str;
+identifier x, ptrname;
+@@
+- FLEXPTR_ALLOC_MEM(x, ptrname, str, strlen(str));
++ FLEXPTR_ALLOC_STR(x, ptrname, str);