diff options
Diffstat (limited to 'cocci.spatches/cleanup-array-lenght.cocci')
-rw-r--r-- | cocci.spatches/cleanup-array-lenght.cocci | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cocci.spatches/cleanup-array-lenght.cocci b/cocci.spatches/cleanup-array-lenght.cocci new file mode 100644 index 0000000..7f30613 --- /dev/null +++ b/cocci.spatches/cleanup-array-lenght.cocci @@ -0,0 +1,11 @@ +// Use the ARRAY_LENGTH() macro when possible +// +// Replace open-coded array length computations with the +// ARRAY_LENGTH() macro + +@@ +type T; +T[] E; +@@ +- (sizeof(E)/sizeof(T)) ++ ARRAY_LENGTH (E) |