diff options
| author | Collin Funk <collin.funk1@gmail.com> | 2025-09-23 19:17:14 -0700 |
|---|---|---|
| committer | Collin Funk <collin.funk1@gmail.com> | 2025-09-24 17:31:57 -0700 |
| commit | 1bc5ec61d8d960e1679b42f55c8f96992ced34ef (patch) | |
| tree | aa458fa9307db7b5b4a9e7704eccc515842112ba /src/od.c | |
| parent | tail: fix tailing larger number of lines in regular files (diff) | |
| download | coreutils-1bc5ec61d8d960e1679b42f55c8f96992ced34ef.tar.gz coreutils-1bc5ec61d8d960e1679b42f55c8f96992ced34ef.zip | |
maint: prefer countof over ARRAY_CARDINALITY
* bootstrap.conf (gnulib_modules): Add stdcountof-h.
* src/system.h: Include stdcountof.h.
(ARRAY_CARDINALITY): Remove definition.
* .gitignore (/lib/stdcountof.h): Ignore Gnulib generated file.
* src/csplit.c: Use countof instead of ARRAY_CARDINALITY.
* src/df.c: Likewise.
* src/digest.c: Likewise.
* src/dircolors.c: Likewise.
* src/factor.c: Likewise.
* src/join.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/sort.c: Likewise.
* src/stdbuf.c: Likewise.
* src/tr.c: Likewise.
Diffstat (limited to 'src/od.c')
| -rw-r--r-- | src/od.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -167,7 +167,7 @@ static const int width_bytes[] = /* Ensure that for each member of 'enum size_spec' there is an initializer in the width_bytes array. */ -static_assert (ARRAY_CARDINALITY (width_bytes) == N_SIZE_SPECS); +static_assert (countof (width_bytes) == N_SIZE_SPECS); /* Names for some non-printing characters. */ static char const charname[33][4] = @@ -761,7 +761,7 @@ decode_one_format (char const *s_orig, char const *s, char const **next, size = sizeof (unsigned int); else { - if (ARRAY_CARDINALITY (integral_type_size) <= size + if (countof (integral_type_size) <= size || integral_type_size[size] == NO_SIZE) { error (0, 0, _("invalid type string %s;\nthis system" @@ -873,7 +873,7 @@ decode_one_format (char const *s_orig, char const *s, char const **next, size = sizeof (double); else { - if (ARRAY_CARDINALITY (fp_type_size) <= size + if (countof (fp_type_size) <= size || fp_type_size[size] == NO_SIZE || (! FLOAT16_SUPPORTED && BF16_SUPPORTED && size == sizeof (bfloat16))) |
