summaryrefslogtreecommitdiff
path: root/src/dircolors.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-24 09:43:01 +0000
committerJim Meyering <jim@meyering.net>2005-10-24 09:43:01 +0000
commitb648b4af3d7dcadd6db295ce1bdf0bae94c36c5b (patch)
tree4c313df7466af070c21e0943491a12ddedf8511f /src/dircolors.c
parent4005639856da00846c76781f8c4acd41a7a4e972 (diff)
downloadcoreutils-b648b4af3d7dcadd6db295ce1bdf0bae94c36c5b.tar.xz
Add a compile-time assertion that the slack_codes
and ls_codes arrays have the same number of elements. This would have prevented the above-fixed bug.
Diffstat (limited to 'src/dircolors.c')
-rw-r--r--src/dircolors.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dircolors.c b/src/dircolors.c
index ace0d78a5..9534d266e 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -62,7 +62,6 @@ enum Shell_syntax
variable. */
static struct obstack lsc_obstack;
-/* FIXME: associate with ls_codes? */
static const char *const slack_codes[] =
{
"NORMAL", "NORM", "FILE", "DIR", "LNK", "LINK",
@@ -78,6 +77,8 @@ static const char *const ls_codes[] =
"so", "bd", "bd", "cd", "cd", "do", "ex", "lc", "lc", "rc", "rc", "ec", "ec"
"su", "su", "sg", "sg", "st", "ow", "ow", "tw", "tw", NULL
};
+#define array_cardinality(Array) (sizeof (Array) / sizeof *(Array))
+verify (array_cardinality (slack_codes) == array_cardinality (ls_codes));
static struct option const long_options[] =
{