aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gl/lib/strnumcmp-in.h51
-rw-r--r--gl/modules/strnumcmp1
-rw-r--r--src/csplit.c5
-rw-r--r--src/expand-common.c3
-rw-r--r--src/expr.c3
-rw-r--r--src/factor.c3
-rw-r--r--src/fmt.c4
-rw-r--r--src/head.c7
-rw-r--r--src/kill.c3
-rw-r--r--src/ls.c2
-rw-r--r--src/nice.c3
-rw-r--r--src/od.c5
-rw-r--r--src/operand2sig.c3
-rw-r--r--src/pr.c5
-rw-r--r--src/printf.c4
-rw-r--r--src/seq.c7
-rw-r--r--src/set-fields.c3
-rw-r--r--src/sort.c13
-rw-r--r--src/stat.c6
-rw-r--r--src/system.h9
-rw-r--r--src/tail.c3
-rw-r--r--src/test.c5
-rw-r--r--src/tr.c7
23 files changed, 77 insertions, 78 deletions
diff --git a/gl/lib/strnumcmp-in.h b/gl/lib/strnumcmp-in.h
index 4662bbeec..7b02145df 100644
--- a/gl/lib/strnumcmp-in.h
+++ b/gl/lib/strnumcmp-in.h
@@ -22,21 +22,12 @@
# include "strnumcmp.h"
+# include "c-ctype.h"
# include <stddef.h>
# define NEGATION_SIGN '-'
# define NUMERIC_ZERO '0'
-/* ISDIGIT differs from isdigit, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char
- or EOF.
- - It's typically faster.
- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
- isdigit unless it's important to use the locale's definition
- of 'digit' even when the host does not conform to POSIX. */
-# define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
-
-
/* Compare strings A and B containing decimal fractions < 1.
DECIMAL_POINT is the decimal point. Each string
should begin with a decimal point followed immediately by the digits
@@ -76,13 +67,13 @@ fraccompare (char const *a, char const *b, char decimal_point)
if (*a == decimal_point && *b == decimal_point)
{
while (*++a == *++b)
- if (! ISDIGIT (*a))
+ if (! c_isdigit (*a))
return 0;
- if (ISDIGIT (*a) && ISDIGIT (*b))
+ if (c_isdigit (*a) && c_isdigit (*b))
return *a - *b;
- if (ISDIGIT (*a))
+ if (c_isdigit (*a))
goto a_trailing_nonzero;
- if (ISDIGIT (*b))
+ if (c_isdigit (*b))
goto b_trailing_nonzero;
return 0;
}
@@ -91,14 +82,14 @@ fraccompare (char const *a, char const *b, char decimal_point)
a_trailing_nonzero:
while (*a == NUMERIC_ZERO)
a++;
- return ISDIGIT (*a);
+ return c_isdigit (*a);
}
else if (*b++ == decimal_point)
{
b_trailing_nonzero:
while (*b == NUMERIC_ZERO)
b++;
- return - ISDIGIT (*b);
+ return - c_isdigit (*b);
}
return 0;
}
@@ -131,7 +122,7 @@ numcompare (char const *a, char const *b,
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
- if (ISDIGIT (tmpa))
+ if (c_isdigit (tmpa))
return -1;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
tmpb = *++b;
@@ -139,13 +130,13 @@ numcompare (char const *a, char const *b,
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
- return - ISDIGIT (tmpb);
+ return - c_isdigit (tmpb);
}
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep);
- while (tmpa == tmpb && ISDIGIT (tmpa))
+ while (tmpa == tmpb && c_isdigit (tmpa))
{
do
tmpa = *++a;
@@ -155,18 +146,18 @@ numcompare (char const *a, char const *b,
while (tmpb == thousands_sep);
}
- if ((tmpa == decimal_point && !ISDIGIT (tmpb))
- || (tmpb == decimal_point && !ISDIGIT (tmpa)))
+ if ((tmpa == decimal_point && !c_isdigit (tmpb))
+ || (tmpb == decimal_point && !c_isdigit (tmpa)))
return fraccompare (b, a, decimal_point);
tmp = tmpb - tmpa;
- for (log_a = 0; ISDIGIT (tmpa); ++log_a)
+ for (log_a = 0; c_isdigit (tmpa); ++log_a)
do
tmpa = *++a;
while (tmpa == thousands_sep);
- for (log_b = 0; ISDIGIT (tmpb); ++log_b)
+ for (log_b = 0; c_isdigit (tmpb); ++log_b)
do
tmpb = *++b;
while (tmpb == thousands_sep);
@@ -188,7 +179,7 @@ numcompare (char const *a, char const *b,
do
tmpb = *++b;
while (tmpb == NUMERIC_ZERO);
- if (ISDIGIT (tmpb))
+ if (c_isdigit (tmpb))
return 1;
while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep)
tmpa = *++a;
@@ -196,7 +187,7 @@ numcompare (char const *a, char const *b,
do
tmpa = *++a;
while (tmpa == NUMERIC_ZERO);
- return ISDIGIT (tmpa);
+ return c_isdigit (tmpa);
}
else
{
@@ -205,7 +196,7 @@ numcompare (char const *a, char const *b,
while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep)
tmpb = *++b;
- while (tmpa == tmpb && ISDIGIT (tmpa))
+ while (tmpa == tmpb && c_isdigit (tmpa))
{
do
tmpa = *++a;
@@ -215,18 +206,18 @@ numcompare (char const *a, char const *b,
while (tmpb == thousands_sep);
}
- if ((tmpa == decimal_point && !ISDIGIT (tmpb))
- || (tmpb == decimal_point && !ISDIGIT (tmpa)))
+ if ((tmpa == decimal_point && !c_isdigit (tmpb))
+ || (tmpb == decimal_point && !c_isdigit (tmpa)))
return fraccompare (a, b, decimal_point);
tmp = tmpa - tmpb;
- for (log_a = 0; ISDIGIT (tmpa); ++log_a)
+ for (log_a = 0; c_isdigit (tmpa); ++log_a)
do
tmpa = *++a;
while (tmpa == thousands_sep);
- for (log_b = 0; ISDIGIT (tmpb); ++log_b)
+ for (log_b = 0; c_isdigit (tmpb); ++log_b)
do
tmpb = *++b;
while (tmpb == thousands_sep);
diff --git a/gl/modules/strnumcmp b/gl/modules/strnumcmp
index 83f4e7c38..f36da19d0 100644
--- a/gl/modules/strnumcmp
+++ b/gl/modules/strnumcmp
@@ -8,6 +8,7 @@ lib/strnumcmp.h
lib/strnumcmp-in.h
Depends-on:
+c-ctype
inline
stddef
diff --git a/src/csplit.c b/src/csplit.c
index babb73949..e6455f00c 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -28,6 +28,7 @@
#include <regex.h>
+#include "c-ctype.h"
#include "fd-reopen.h"
#include "quote.h"
#include "safe-read.h"
@@ -1262,10 +1263,10 @@ max_out (char *format)
percent = true;
int flags;
f += get_format_flags (f, &flags);
- while (ISDIGIT (*f))
+ while (c_isdigit (*f))
f++;
if (*f == '.')
- while (ISDIGIT (*++f))
+ while (c_isdigit (*++f))
continue;
check_format_conv_type (f, flags);
}
diff --git a/src/expand-common.c b/src/expand-common.c
index e3f9ea84e..2fa0e8910 100644
--- a/src/expand-common.c
+++ b/src/expand-common.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <sys/types.h>
#include "system.h"
+#include "c-ctype.h"
#include "fadvise.h"
#include "quote.h"
@@ -183,7 +184,7 @@ parse_tab_stops (char const *stops)
increment_tabval = true;
extend_tabval = false;
}
- else if (ISDIGIT (*stops))
+ else if (c_isdigit (*stops))
{
if (!have_tabval)
{
diff --git a/src/expr.c b/src/expr.c
index 3ecec0735..5a680d2ec 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -35,6 +35,7 @@
#include <gmp.h>
#include <regex.h>
+#include "c-ctype.h"
#include "long-options.h"
#include "mcel.h"
#include "strnumcmp.h"
@@ -439,7 +440,7 @@ looks_like_integer (char const *cp)
cp += (*cp == '-');
do
- if (! ISDIGIT (*cp))
+ if (! c_isdigit (*cp))
return false;
while (*++cp);
diff --git a/src/factor.c b/src/factor.c
index 85cd1b1c9..04aa8806e 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -109,6 +109,7 @@
#include "system.h"
#include "assure.h"
+#include "c-ctype.h"
#include "full-write.h"
#include "quote.h"
#include "readtokens.h"
@@ -2257,7 +2258,7 @@ strto2uintmax (uintmax_t *hip, uintmax_t *lop, char const *s)
if (c == 0)
break;
- if (UNLIKELY (!ISDIGIT (c)))
+ if (UNLIKELY (!c_isdigit (c)))
{
err = LONGINT_INVALID;
break;
diff --git a/src/fmt.c b/src/fmt.c
index 59086f35e..122debc9d 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -334,7 +334,7 @@ main (int argc, char **argv)
prefix = "";
prefix_length = prefix_lead_space = prefix_full_length = 0;
- if (argc > 1 && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
+ if (argc > 1 && argv[1][0] == '-' && c_isdigit (argv[1][1]))
{
/* Old option syntax; a dash followed by one or more digits. */
max_width_option = argv[1] + 1;
@@ -351,7 +351,7 @@ main (int argc, char **argv)
switch (optchar)
{
default:
- if (ISDIGIT (optchar))
+ if (c_isdigit (optchar))
error (0, 0, _("invalid option -- %c; -WIDTH is recognized\
only when it is the first\noption; use -w N instead"),
optchar);
diff --git a/src/head.c b/src/head.c
index cb418b449..710262ec9 100644
--- a/src/head.c
+++ b/src/head.c
@@ -32,6 +32,7 @@
#include "system.h"
#include "assure.h"
+#include "c-ctype.h"
#include "full-read.h"
#include "safe-read.h"
#include "stat-size.h"
@@ -944,7 +945,7 @@ main (int argc, char **argv)
line_end = '\n';
- if (1 < argc && argv[1][0] == '-' && ISDIGIT (argv[1][1]))
+ if (1 < argc && argv[1][0] == '-' && c_isdigit (argv[1][1]))
{
char *a = argv[1];
char *n_string = ++a;
@@ -954,7 +955,7 @@ main (int argc, char **argv)
/* Old option syntax; a dash, one or more digits, and one or
more option letters. Move past the number. */
do ++a;
- while (ISDIGIT (*a));
+ while (c_isdigit (*a));
/* Pointer to the byte after the last digit. */
end_n_string = a;
@@ -1055,7 +1056,7 @@ main (int argc, char **argv)
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- if (ISDIGIT (c))
+ if (c_isdigit (c))
error (0, 0, _("invalid trailing option -- %c"), c);
usage (EXIT_FAILURE);
}
diff --git a/src/kill.c b/src/kill.c
index 314855653..591371c19 100644
--- a/src/kill.c
+++ b/src/kill.c
@@ -23,6 +23,7 @@
#include <signal.h>
#include "system.h"
+#include "c-ctype.h"
#include "sig2str.h"
#include "operand2sig.h"
#include "quote.h"
@@ -154,7 +155,7 @@ list_signals (bool table, char *const *argv)
signum = operand2sig (*argv);
if (signum < 0)
status = EXIT_FAILURE;
- else if (ISDIGIT (**argv))
+ else if (c_isdigit (**argv))
{
if (sig2str (signum, signame) == 0)
puts (signame);
diff --git a/src/ls.c b/src/ls.c
index 4732fc861..c9f389a69 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1366,7 +1366,7 @@ abmon_init (char abmon[12][ABFORMAT_SIZE])
int fill = max_mon_width - mon_width[i];
if (ABFORMAT_SIZE - mon_len[i] <= fill)
return false;
- bool align_left = !isdigit (to_uchar (abmon[i][0]));
+ bool align_left = !c_isdigit (abmon[i][0]);
int fill_offset;
if (align_left)
fill_offset = mon_len[i];
diff --git a/src/nice.c b/src/nice.c
index 58ab59fd3..e935191be 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -29,6 +29,7 @@
# include <sys/resource.h>
#endif
+#include "c-ctype.h"
#include "quote.h"
#include "xstrtol.h"
@@ -118,7 +119,7 @@ main (int argc, char **argv)
{
char const *s = argv[i];
- if (s[0] == '-' && ISDIGIT (s[1 + (s[1] == '-' || s[1] == '+')]))
+ if (s[0] == '-' && c_isdigit (s[1 + (s[1] == '-' || s[1] == '+')]))
{
adjustment_given = s + 1;
++i;
diff --git a/src/od.c b/src/od.c
index 37a934a78..45a425e10 100644
--- a/src/od.c
+++ b/src/od.c
@@ -26,6 +26,7 @@
#include "system.h"
#include "argmatch.h"
#include "assure.h"
+#include "c-ctype.h"
#include "ftoastr.h"
#include "quote.h"
#include "stat-size.h"
@@ -632,7 +633,7 @@ simple_strtoi (char const *s, char const **p, int *val)
{
int sum;
- for (sum = 0; ISDIGIT (*s); s++)
+ for (sum = 0; c_isdigit (*s); s++)
if (ckd_mul (&sum, sum, 10) || ckd_add (&sum, sum, *s - '0'))
return false;
*p = s;
@@ -1888,7 +1889,7 @@ main (int argc, char **argv)
case 2:
if ((traditional || argv[optind + 1][0] == '+'
- || ISDIGIT (argv[optind + 1][0]))
+ || c_isdigit (argv[optind + 1][0]))
&& parse_old_offset (argv[optind + 1], &o2))
{
if (traditional && parse_old_offset (argv[optind], &o1))
diff --git a/src/operand2sig.c b/src/operand2sig.c
index b46cb1bed..fe8749444 100644
--- a/src/operand2sig.c
+++ b/src/operand2sig.c
@@ -27,6 +27,7 @@
#include <sys/wait.h>
#include "system.h"
+#include "c-ctype.h"
#include "quote.h"
#include "sig2str.h"
#include "operand2sig.h"
@@ -36,7 +37,7 @@ operand2sig (char const *operand)
{
int signum;
- if (ISDIGIT (*operand))
+ if (c_isdigit (*operand))
{
/* Note we don't put a limit on the maximum value passed,
because we're checking shell $? values here, and ksh for
diff --git a/src/pr.c b/src/pr.c
index a08da2fd7..eafab398b 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -313,6 +313,7 @@
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "c-ctype.h"
#include "fadvise.h"
#include "hard-locale.h"
#include "mbswidth.h"
@@ -887,7 +888,7 @@ main (int argc, char **argv)
if (c == -1)
break;
- if (ISDIGIT (c))
+ if (c_isdigit (c))
{
/* Accumulate column-count digits specified via old-style options. */
if (n_digits + 1 >= n_alloc)
@@ -1175,7 +1176,7 @@ getoptarg (char *arg, char switch_char, char *character, int *number)
usage (EXIT_FAILURE);
}
- if (!ISDIGIT (*arg))
+ if (!c_isdigit (*arg))
*character = *arg++;
if (*arg)
{
diff --git a/src/printf.c b/src/printf.c
index bb5a7c723..0d5921e75 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -612,7 +612,7 @@ print_formatted (char const *format, int argc, char **argv)
have_field_width = true;
}
else
- while (ISDIGIT (*ac.f))
+ while (c_isdigit (*ac.f))
*pdirec++ = *ac.f++;
if (*ac.f == '.')
{
@@ -645,7 +645,7 @@ print_formatted (char const *format, int argc, char **argv)
have_precision = true;
}
else
- while (ISDIGIT (*ac.f))
+ while (c_isdigit (*ac.f))
*pdirec++ = *ac.f++;
}
diff --git a/src/seq.c b/src/seq.c
index 1b3be26ba..63bdc5d94 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include "system.h"
+#include "c-ctype.h"
#include "cl-strtod.h"
#include "full-write.h"
#include "quote.h"
@@ -190,7 +191,7 @@ scan_arg (char const *arg)
ret.width += (fraction_len == 0 /* #. -> # */
? -1
: (decimal_point == arg /* .# -> 0.# */
- || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
+ || ! c_isdigit (decimal_point[-1]))); /* -.# -> 0.# */
}
char const *e = strchr (arg, 'e');
if (! e)
@@ -539,7 +540,7 @@ static bool
all_digits_p (char const *s)
{
size_t n = strlen (s);
- return ISDIGIT (s[0]) && n == strspn (s, "0123456789");
+ return c_isdigit (s[0]) && n == strspn (s, "0123456789");
}
int
@@ -571,7 +572,7 @@ main (int argc, char **argv)
while (optind < argc)
{
if (argv[optind][0] == '-'
- && ((optc = argv[optind][1]) == '.' || ISDIGIT (optc)))
+ && ((optc = argv[optind][1]) == '.' || c_isdigit (optc)))
{
/* means negative number */
break;
diff --git a/src/set-fields.c b/src/set-fields.c
index 6102282ea..06806b156 100644
--- a/src/set-fields.c
+++ b/src/set-fields.c
@@ -20,6 +20,7 @@
#include "system.h"
#include <ctype.h>
+#include "c-ctype.h"
#include "quote.h"
#include "set-fields.h"
@@ -230,7 +231,7 @@ set_fields (char const *fieldstr, unsigned int options)
lhs_specified = false;
rhs_specified = false;
}
- else if (ISDIGIT (*fieldstr))
+ else if (c_isdigit (*fieldstr))
{
/* Record beginning of digit string, in case we have to
complain about it. */
diff --git a/src/sort.c b/src/sort.c
index 720500774..4f875b585 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -32,6 +32,7 @@
#include "system.h"
#include "argmatch.h"
#include "assure.h"
+#include "c-ctype.h"
#include "fadvise.h"
#include "filevercmp.h"
#include "flexmember.h"
@@ -1389,7 +1390,7 @@ specify_sort_size (int oi, char c, char const *s)
enum strtol_error e = xstrtoumax (s, &suffix, 10, &n, "EgGkKmMPQRtTYZ");
/* The default unit is KiB. */
- if (e == LONGINT_OK && ISDIGIT (suffix[-1]))
+ if (e == LONGINT_OK && c_isdigit (suffix[-1]))
{
if (n <= UINTMAX_MAX / 1024)
n *= 1024;
@@ -1398,7 +1399,7 @@ specify_sort_size (int oi, char c, char const *s)
}
/* A 'b' suffix means bytes; a '%' suffix means percent of memory. */
- if (e == LONGINT_INVALID_SUFFIX_CHAR && ISDIGIT (suffix[-1]) && ! suffix[1])
+ if (e == LONGINT_INVALID_SUFFIX_CHAR && c_isdigit (suffix[-1]) && ! suffix[1])
switch (suffix[0])
{
case 'b':
@@ -1921,7 +1922,7 @@ traverse_raw_number (char const **number)
to be lacking in units.
FIXME: add support for multibyte thousands_sep and decimal_point. */
- while (ISDIGIT (ch = *p++))
+ while (c_isdigit (ch = *p++))
{
if (max_digit < ch)
max_digit = ch;
@@ -1942,7 +1943,7 @@ traverse_raw_number (char const **number)
}
if (ch == decimal_point)
- while (ISDIGIT (ch = *p++))
+ while (c_isdigit (ch = *p++))
if (max_digit < ch)
max_digit = ch;
@@ -4476,7 +4477,7 @@ main (int argc, char **argv)
if (optarg[0] == '+')
{
bool minus_pos_usage = (optind != argc && argv[optind][0] == '-'
- && ISDIGIT (argv[optind][1]));
+ && c_isdigit (argv[optind][1]));
traditional_usage |= minus_pos_usage && !posixly_correct;
if (traditional_usage)
{
@@ -4701,7 +4702,7 @@ main (int argc, char **argv)
if (optarg == argv[optind - 1])
{
char const *p;
- for (p = optarg; ISDIGIT (*p); p++)
+ for (p = optarg; c_isdigit (*p); p++)
continue;
optind -= (*p != '\0');
}
diff --git a/src/stat.c b/src/stat.c
index 264efc296..faae92748 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -738,7 +738,7 @@ out_epoch_sec (char *pformat, size_t prefix_len,
sec_prefix_len = dot - pformat;
pformat[prefix_len] = '\0';
- if (ISDIGIT (dot[1]))
+ if (c_isdigit (dot[1]))
{
long int lprec = strtol (dot + 1, nullptr, 10);
precision = (lprec <= INT_MAX ? lprec : INT_MAX);
@@ -748,7 +748,7 @@ out_epoch_sec (char *pformat, size_t prefix_len,
precision = 9;
}
- if (precision && ISDIGIT (dot[-1]))
+ if (precision && c_isdigit (dot[-1]))
{
/* If a nontrivial width is given, subtract the width of the
decimal point and PRECISION digits that will be output
@@ -758,7 +758,7 @@ out_epoch_sec (char *pformat, size_t prefix_len,
do
--p;
- while (ISDIGIT (p[-1]));
+ while (c_isdigit (p[-1]));
long int lwidth = strtol (p, nullptr, 10);
width = (lwidth <= INT_MAX ? lwidth : INT_MAX);
diff --git a/src/system.h b/src/system.h
index ea30fb4b6..a95613b86 100644
--- a/src/system.h
+++ b/src/system.h
@@ -143,15 +143,6 @@ enum
#include "timespec.h"
-/* ISDIGIT differs from isdigit, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char
- or EOF.
- - It's typically faster.
- POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
- isdigit unless it's important to use the locale's definition
- of 'digit' even when the host does not conform to POSIX. */
-#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
-
/* Convert a possibly-signed character to an unsigned character. This is
a bit safer than casting to unsigned char, since it catches some type
errors that the cast doesn't. */
diff --git a/src/tail.c b/src/tail.c
index 19f572556..99a23c966 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -33,6 +33,7 @@
#include "system.h"
#include "argmatch.h"
#include "assure.h"
+#include "c-ctype.h"
#include "cl-strtod.h"
#include "fcntl--.h"
#include "iopoll.h"
@@ -2157,7 +2158,7 @@ parse_obsolete_option (int argc, char * const *argv, uintmax_t *n_units)
}
n_string = p;
- while (ISDIGIT (*p))
+ while (c_isdigit (*p))
p++;
n_string_end = p;
diff --git a/src/test.c b/src/test.c
index 7d3a78879..23e75b02e 100644
--- a/src/test.c
+++ b/src/test.c
@@ -40,6 +40,7 @@
#include "system.h"
#include "assure.h"
+#include "c-ctype.h"
#include "quote.h"
#include "stat-time.h"
#include "strnumcmp.h"
@@ -143,9 +144,9 @@ find_int (char const *string)
p += (*p == '-');
}
- if (ISDIGIT (*p++))
+ if (c_isdigit (*p++))
{
- while (ISDIGIT (*p))
+ while (c_isdigit (*p))
p++;
while (isspace (to_uchar (*p)))
p++;
diff --git a/src/tr.c b/src/tr.c
index 4201dd0aa..2a7b7dfb6 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -25,6 +25,7 @@
#include "system.h"
#include "assure.h"
+#include "c-ctype.h"
#include "fadvise.h"
#include "quote.h"
#include "safe-read.h"
@@ -383,7 +384,7 @@ is_char_class_member (enum Char_class char_class, unsigned char c)
result = iscntrl (c);
break;
case CC_DIGIT:
- result = isdigit (c);
+ result = c_isdigit (c);
break;
case CC_GRAPH:
result = isgraph (c);
@@ -404,7 +405,7 @@ is_char_class_member (enum Char_class char_class, unsigned char c)
result = isupper (c);
break;
case CC_XDIGIT:
- result = isxdigit (c);
+ result = c_isxdigit (c);
break;
default:
unreachable ();
@@ -830,7 +831,7 @@ star_digits_closebracket (const struct E_string *es, size_t idx)
return false;
for (size_t i = idx + 1; i < es->len; i++)
- if (!ISDIGIT (es->s[i]) || es->escaped[i])
+ if (!c_isdigit (es->s[i]) || es->escaped[i])
return es_match (es, i, ']');
return false;
}