diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-08-20 21:03:24 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-08-20 21:03:24 +0000 |
commit | 66fe09eebb813b79e14279df11d723b433a973fb (patch) | |
tree | 5e2382045fa4be718fbb51aa9d2405dcc0b4813f /os-posix.c | |
parent | f143efa60c44c65c22aeeb04217f3501e3d04b22 (diff) | |
download | qemu-66fe09eebb813b79e14279df11d723b433a973fb.zip qemu-66fe09eebb813b79e14279df11d723b433a973fb.tar.gz qemu-66fe09eebb813b79e14279df11d723b433a973fb.tar.bz2 |
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>
Diffstat (limited to 'os-posix.c')
-rw-r--r-- | os-posix.c | 2 |
1 files changed, 1 insertions, 1 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; |