Skip to content

Commit e98958c

Browse files
committed
cocci: do not directly access the .d_type member in struct dirent
Add a rule to catch direct access to the .d_type member and use DTYPE() macro instead, except in the emulation code paths that work on platforms that do have the member. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9b57d6f commit e98958c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contrib/coccinelle/dtype.cocci

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@@
2+
identifier f != { finddata2dirent, precompose_utf8_readdir };
3+
struct dirent *E;
4+
@@
5+
f(...) {<...
6+
- E->d_type
7+
+ DTYPE(E)
8+
...>}

0 commit comments

Comments
 (0)