summaryrefslogtreecommitdiff
path: root/src/tr.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-05-17 12:47:24 +0200
committerJim Meyering <meyering@redhat.com>2009-05-17 13:59:12 +0200
commit65ed4ca07bd18c2038b5863ed1e18d3bfc8e696d (patch)
tree60b8239c2282e6305249d252a09d6cdf33c0f543 /src/tr.c
parent9b54961b13af78c4805076c6b6739cc282b53c5e (diff)
downloadcoreutils-65ed4ca07bd18c2038b5863ed1e18d3bfc8e696d.tar.xz
build: tr: avoid a warning due to newer gcc's -Wenum-compare
* src/tr.c (N_CHAR_CLASSES): Remove anonymous enum definition. (look_up_char_class): Use ARRAY_CARDINALITY, rather than N_CHAR_CLASSES.
Diffstat (limited to 'src/tr.c')
-rw-r--r--src/tr.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/tr.c b/src/tr.c
index f4b531731..e9338d48f 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1,5 +1,5 @@
/* tr -- a filter to translate characters
- Copyright (C) 91, 1995-2008 Free Software Foundation, Inc.
+ Copyright (C) 91, 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
@@ -246,7 +246,6 @@ static char const *const char_class_name[] =
"alnum", "alpha", "blank", "cntrl", "digit", "graph",
"lower", "print", "punct", "space", "upper", "xdigit"
};
-enum { N_CHAR_CLASSES = sizeof char_class_name / sizeof char_class_name[0] };
/* Array of boolean values. A character `c' is a member of the
squeeze set if and only if in_squeeze_set[c] is true. The squeeze
@@ -547,7 +546,7 @@ look_up_char_class (char const *class_str, size_t len)
{
enum Char_class i;
- for (i = 0; i < N_CHAR_CLASSES; i++)
+ for (i = 0; i < ARRAY_CARDINALITY (char_class_name); i++)
if (strncmp (class_str, char_class_name[i], len) == 0
&& strlen (char_class_name[i]) == len)
return i;