* src/sort.c (main): Use ARRAY_CARDINALITY, rather than open-coding it.
* src/factor.c (WHEEL_END): Likewise.
* src/csplit.c (main): Likewise.
* src/od.c: Likewise,
* src/ls.c (main): Likewise.
(N_ENTRIES): Remove definition. Use ARRAY_CARDINALITY instead.
* src/dircolors.c: Likewise.
(array_len): Remove definition.
SIGXFSZ,
#endif
};
- enum { nsigs = sizeof sig / sizeof sig[0] };
+ enum { nsigs = ARRAY_CARDINALITY (sig) };
struct sigaction act;
/* dircolors - output commands to set the LS_COLOR environment variable
- Copyright (C) 1996-2008 Free Software Foundation, Inc.
+ Copyright (C) 1996-2009 Free Software Foundation, Inc.
Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000 H. Peter Anvin
This program is free software: you can redistribute it and/or modify
"so", "bd", "bd", "cd", "cd", "do", "ex", "lc", "lc", "rc", "rc", "ec", "ec",
"su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", "ca", "hl", "cl", NULL
};
-#define array_len(Array) (sizeof (Array) / sizeof *(Array))
-verify (array_len (slack_codes) == array_len (ls_codes));
+verify (ARRAY_CARDINALITY (slack_codes) == ARRAY_CARDINALITY (ls_codes));
static struct option const long_options[] =
{
};
#define WHEEL_START (wheel_tab + WHEEL_SIZE)
-#define WHEEL_END (wheel_tab + (sizeof wheel_tab / sizeof wheel_tab[0]))
+#define WHEEL_END (wheel_tab + ARRAY_CARDINALITY (wheel_tab))
/* FIXME: comment */
SIGXFSZ,
#endif
};
- enum { nsigs = sizeof sig / sizeof sig[0] };
+ enum { nsigs = ARRAY_CARDINALITY (sig) };
#if ! SA_NOCLDSTOP
bool caught_sig[nsigs];
initialize_exit_failure (LS_FAILURE);
atexit (close_stdout);
-#define N_ENTRIES(Array) (sizeof Array / sizeof *(Array))
- assert (N_ENTRIES (color_indicator) + 1 == N_ENTRIES (indicator_name));
+ assert (ARRAY_CARDINALITY (color_indicator) + 1
+ == ARRAY_CARDINALITY (indicator_name));
exit_status = EXIT_SUCCESS;
print_dir_name = true;
/* od -- dump files in octal and other formats
- Copyright (C) 92, 1995-2008 Free Software Foundation, Inc.
+ Copyright (C) 92, 1995-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/* It'll be a while before we see integral types wider than 16 bytes,
but if/when it happens, this check will catch it. Without this check,
a wider type would provoke a buffer overrun. */
-verify (MAX_INTEGRAL_TYPE_SIZE
- < sizeof bytes_to_hex_digits / sizeof *bytes_to_hex_digits);
+verify (MAX_INTEGRAL_TYPE_SIZE < ARRAY_CARDINALITY (bytes_to_hex_digits));
/* Make sure the other arrays have the same length. */
verify (sizeof bytes_to_oct_digits == sizeof bytes_to_signed_dec_digits);
/* Ensure that for each member of `enum size_spec' there is an
initializer in the width_bytes array. */
-verify (sizeof width_bytes / sizeof width_bytes[0] == N_SIZE_SPECS);
+verify (ARRAY_CARDINALITY (width_bytes) == N_SIZE_SPECS);
/* Names for some non-printing characters. */
static char const charname[33][4] =
SIGXFSZ,
#endif
};
- enum { nsigs = sizeof sig / sizeof sig[0] };
+ enum { nsigs = ARRAY_CARDINALITY (sig) };
#if SA_NOCLDSTOP
struct sigaction act;