From: Denton Liu Date: Wed, 3 Apr 2019 22:00:06 +0000 (-0700) Subject: cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR X-Git-Tag: v2.22.0-rc0~78^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0cf2b0a04bb9b48fb0d91f47ce5fd2ea436112c8;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- 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);