
* src/comp.c (emit_limple_insn): * src/msdos.c (dos_set_keyboard, dos_rawgetc): * src/sysdep.c (convert_speed, list_system_processes): * src/w32fns.c (deliver_wm_chars, Fx_file_dialog): * src/w32term.c (record_event, w32_read_socket): Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'. * admin/coccinelle/arrayelts.cocci: New file.
21 lines
246 B
Text
21 lines
246 B
Text
// Use the ARRAYELTS macro where possible.
|
|
@@
|
|
type T;
|
|
T[] E;
|
|
@@
|
|
- (sizeof (E) / sizeof (E[...]))
|
|
+ ARRAYELTS (E)
|
|
|
|
@@
|
|
type T;
|
|
T[] E;
|
|
@@
|
|
- (sizeof (E) / sizeof (T))
|
|
+ ARRAYELTS (E)
|
|
|
|
@@
|
|
type T;
|
|
T[] E;
|
|
@@
|
|
- (sizeof (E) / sizeof (*E))
|
|
+ ARRAYELTS (E)
|