Skip to content

Commit 0cf2b0a

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 577314c commit 0cf2b0a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contrib/coccinelle/flex_alloc.cocci

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)