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>

Denton Liu committed Apr 3, 2019 at 15:00 UTC 0cf2b0a04bb9b48fb0d91f47ce5fd2ea436112c8
1 file changed +13
contrib/coccinelle/flex_alloc.cocci new
+13
@@ -0,0 +1,13 @@
1 +@@
2 +expression str;
3 +identifier x, flexname;
4 +@@
5 +- FLEX_ALLOC_MEM(x, flexname, str, strlen(str));
6 ++ FLEX_ALLOC_STR(x, flexname, str);
7 +
8 +@@
9 +expression str;
10 +identifier x, ptrname;
11 +@@
12 +- FLEXPTR_ALLOC_MEM(x, ptrname, str, strlen(str));
13 ++ FLEXPTR_ALLOC_STR(x, ptrname, str);