summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-08-09 09:45:17 +0000
committerJim Meyering <jim@meyering.net>2006-08-09 09:45:17 +0000
commita5e7cc0811dcf543078c0f7f79fa159232a0ea6f (patch)
tree897f740a980ebdc9a7e7b05d3d987632043ca0f8
parentff7f318ae13493351ec56e073a32df702cfc0356 (diff)
downloadcoreutils-a5e7cc0811dcf543078c0f7f79fa159232a0ea6f.tar.xz
Add a compile-time check to ensure that filetype
and filetype_letter have the same number of elements.
-rw-r--r--ChangeLog3
-rw-r--r--src/ls.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 34b437249..ccb32c667 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2006-08-09 Jim Meyering <jim@meyering.net>
+ * src/ls.c: Add a compile-time check to ensure that filetype
+ and filetype_letter have the same number of elements.
+
* tests/misc/sort-rand: Remove use of --seed=S.
2006-08-08 Paul Eggert <eggert@cs.ucla.edu>
diff --git a/src/ls.c b/src/ls.c
index 85a4bc7e7..40de927bf 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -162,9 +162,12 @@ enum filetype
/* Display letters and indicators for each filetype.
Keep these in sync with enum filetype. */
-
static char const filetype_letter[] = "?pcdb-lswd";
+/* Ensure that filetype and filetype_letter have the same
+ number of elements. */
+verify (sizeof filetype_letter - 1 == arg_directory + 1);
+
#define FILETYPE_INDICATORS \
{ \
C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, \