diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-25 10:55:35 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-06-25 10:55:35 +0000 |
commit | 80b8b39899a09c7516920cda5fd343b3086d4824 (patch) | |
tree | aa9903fd6b64d19c5f640fa302272d85c92b204e /coreutils | |
parent | 1399282b47bb218132a554cbe5b2b0ce4dcc055f (diff) | |
download | busybox-w32-80b8b39899a09c7516920cda5fd343b3086d4824.tar.gz busybox-w32-80b8b39899a09c7516920cda5fd343b3086d4824.tar.bz2 busybox-w32-80b8b39899a09c7516920cda5fd343b3086d4824.zip |
Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>)
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/od_bloaty.c | 2 | ||||
-rw-r--r-- | coreutils/stty.c | 4 | ||||
-rw-r--r-- | coreutils/test.c | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index 325085626..af5eba9ce 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -158,7 +158,7 @@ static const signed char width_bytes[] = { | |||
158 | initializer in the width_bytes array. */ | 158 | initializer in the width_bytes array. */ |
159 | struct dummy { | 159 | struct dummy { |
160 | int assert_width_bytes_matches_size_spec_decl | 160 | int assert_width_bytes_matches_size_spec_decl |
161 | [sizeof width_bytes / sizeof width_bytes[0] == N_SIZE_SPECS ? 1 : -1]; | 161 | [ARRAY_SIZE(width_bytes) == N_SIZE_SPECS ? 1 : -1]; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static size_t string_min; | 164 | static size_t string_min; |
diff --git a/coreutils/stty.c b/coreutils/stty.c index e6d054ff2..0983532cf 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -319,7 +319,7 @@ static const struct mode_info mode_info[] = { | |||
319 | }; | 319 | }; |
320 | 320 | ||
321 | enum { | 321 | enum { |
322 | NUM_mode_info = (sizeof(mode_info) / sizeof(mode_info[0])) | 322 | NUM_mode_info = ARRAY_SIZE(mode_info) |
323 | }; | 323 | }; |
324 | 324 | ||
325 | /* Control character settings */ | 325 | /* Control character settings */ |
@@ -371,7 +371,7 @@ static const struct control_info control_info[] = { | |||
371 | }; | 371 | }; |
372 | 372 | ||
373 | enum { | 373 | enum { |
374 | NUM_control_info = (sizeof(control_info) / sizeof(control_info[0])) | 374 | NUM_control_info = ARRAY_SIZE(control_info) |
375 | }; | 375 | }; |
376 | 376 | ||
377 | /* The width of the screen, for output wrapping */ | 377 | /* The width of the screen, for output wrapping */ |
diff --git a/coreutils/test.c b/coreutils/test.c index 36fb38a64..7b87a42f9 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -146,7 +146,6 @@ static const struct t_op { | |||
146 | { ")" , RPAREN , PAREN }, | 146 | { ")" , RPAREN , PAREN }, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | enum { NUM_OPS = sizeof(ops) / sizeof(ops[0]) }; | ||
150 | 149 | ||
151 | #if ENABLE_FEATURE_TEST_64 | 150 | #if ENABLE_FEATURE_TEST_64 |
152 | typedef int64_t arith_t; | 151 | typedef int64_t arith_t; |
@@ -471,7 +470,7 @@ static enum token t_lex(char *s) | |||
471 | return op->op_num; | 470 | return op->op_num; |
472 | } | 471 | } |
473 | op++; | 472 | op++; |
474 | } while (op < ops + NUM_OPS); | 473 | } while (op < ops + ARRAY_SIZE(ops)); |
475 | 474 | ||
476 | return OPERAND; | 475 | return OPERAND; |
477 | } | 476 | } |