tweaks: remove non-UTF-8 code from three more functions

This commit is contained in:
Benno Schulenberg 2020-03-12 15:50:06 +01:00
parent b2c63c3d3c
commit 004af03ea5
1 changed files with 0 additions and 15 deletions

View File

@ -47,33 +47,23 @@ 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
if (use_utf8) {
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswalpha(wc);
} else
#endif
return isalpha((unsigned char)*c);
}
/* Return TRUE when the given character is some kind of letter or a digit. */
bool is_alnum_char(const char *c)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswalnum(wc);
} else
#endif
return isalnum((unsigned char)*c);
}
/* Return TRUE when the given character is space or tab or other whitespace. */
@ -105,17 +95,12 @@ 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
if (use_utf8) {
wchar_t wc;
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
return FALSE;
return iswpunct(wc);
} else
#endif
return ispunct((unsigned char)*c);
}
/* Return TRUE when the given character is word-forming (it is alphanumeric or