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 /editors | |
parent | 1399282b47bb218132a554cbe5b2b0ce4dcc055f (diff) |
Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>)
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 4 | ||||
-rw-r--r-- | editors/vi.c | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/editors/awk.c b/editors/awk.c index 90ba64348..940a7948e 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -390,7 +390,7 @@ static const char vValues[] = /* hash size may grow to these values */ #define FIRST_PRIME 61; static const unsigned PRIMES[] = { 251, 1021, 4093, 16381, 65521 }; -enum { NPRIMES = sizeof(PRIMES) / sizeof(PRIMES[0]) }; + /* Globals. Split in two parts so that first one is addressed @@ -570,7 +570,7 @@ static void hash_rebuild(xhash *hash) unsigned newsize, i, idx; hash_item **newitems, *hi, *thi; - if (hash->nprime == NPRIMES) + if (hash->nprime == ARRAY_SIZE(PRIMES)) return; newsize = PRIMES[hash->nprime++]; diff --git a/editors/vi.c b/editors/vi.c index b961ca5b8..01d45e50e 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2230,8 +2230,7 @@ static char readit(void) // read (maybe cursor) key from stdin {"[13~", VI_K_FUN3}, // Function Key F3 {"[14~", VI_K_FUN4}, // Function Key F4 }; - -#define ESCCMDS_COUNT (sizeof(esccmds)/sizeof(struct esc_cmds)) + enum { ESCCMDS_COUNT = ARRAY_SIZE(esccmds) }; alarm(0); // turn alarm OFF while we wait for input fflush(stdout); |