build: restore non-UTF8 fallbacks, to allow compiling with --disable-utf8

Commits b2c63c3d and 004af03e from yesterday mistakenly removed those
calls.
This commit is contained in:
Benno Schulenberg 2020-03-13 11:43:31 +01:00
parent 639f37669a
commit fcda76f684
1 changed files with 16 additions and 0 deletions

View File

@ -47,28 +47,37 @@ bool using_utf8(void)
/* Return TRUE when the given character is some kind of letter. */
bool is_alpha_char(const char *c)
{
#ifdef ENABLE_UTF8
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswalpha(wc);
#else
return isalpha((unsigned char)*c);
#endif
}
/* Return TRUE when the given character is some kind of letter or a digit. */
bool is_alnum_char(const char *c)
{
#ifdef ENABLE_UTF8
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswalnum(wc);
#else
return isalnum((unsigned char)*c);
#endif
}
/* Return TRUE when the given character is space or tab or other whitespace. */
bool is_blank_char(const char *c)
{
#ifdef ENABLE_UTF8
wchar_t wc;
if ((signed char)*c >= 0)
@ -78,6 +87,9 @@ bool is_blank_char(const char *c)
return FALSE;
return iswblank(wc);
#else
return isblank((unsigned char)*c);
#endif
}
/* Return TRUE when the given character is a control character. */
@ -95,12 +107,16 @@ bool is_cntrl_char(const char *c)
/* Return TRUE when the given character is a punctuation character. */
bool is_punct_char(const char *c)
{
#ifdef ENABLE_UTF8
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswpunct(wc);
#else
return ispunct((unsigned char)*c);
#endif
}
/* Return TRUE when the given character is word-forming (it is alphanumeric or