mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
Use ARRAY_SIZE macro
Replace array size calculations with ARRAY_SIZE macro. Implemented with this Coccinelle semantic patch, adapted from Linux kernel: @@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(E[...])) + ARRAY_SIZE(E) @@ type T; T[] E; @@ - (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) Some files (*-dis.c, tests/*) had to be filtered out. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
f143efa60c
commit
66fe09eebb
2 changed files with 2 additions and 2 deletions
|
|
@ -110,7 +110,7 @@ char *os_find_datadir(const char *argv0)
|
|||
size_t len = sizeof(buf) - 1;
|
||||
|
||||
*buf = '\0';
|
||||
if (!sysctl(mib, sizeof(mib)/sizeof(*mib), buf, &len, NULL, 0) &&
|
||||
if (!sysctl(mib, ARRAY_SIZE(mib), buf, &len, NULL, 0) &&
|
||||
*buf) {
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
p = buf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue