From 77883ac914939e3fd5b3001b78857a3d11942104 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 1 Mar 2023 10:34:41 +0100 Subject: [PATCH] Cygwin: wcitoascii: move to wchar.h as inline function Signed-off-by: Corinna Vinschen --- winsup/cygwin/glob.cc | 6 ------ winsup/cygwin/local_includes/wchar.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/glob.cc b/winsup/cygwin/glob.cc index 63a07a930..0b85a147a 100644 --- a/winsup/cygwin/glob.cc +++ b/winsup/cygwin/glob.cc @@ -481,12 +481,6 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) return patbuf; } -static void -wcitoascii(char *dst, wint_t *src) -{ - while ((*dst++ = *src++)); -} - /* * The main glob() routine: compiles the pattern (optionally processing * quotes), calls glob1() to do the real pattern matching, and finally diff --git a/winsup/cygwin/local_includes/wchar.h b/winsup/cygwin/local_includes/wchar.h index 3907732a2..b09d014c0 100644 --- a/winsup/cygwin/local_includes/wchar.h +++ b/winsup/cygwin/local_includes/wchar.h @@ -52,6 +52,14 @@ size_t wirtomb (char *, wint_t, mbstate_t *); a UTF-32 value. Defined in strfuncs.cc */ extern size_t mbrtowi (wint_t *, const char *, size_t, mbstate_t *); +/* convert wint_t string to char string, but *only* if the string consists + entirely of ASCII chars */ +static inline void +wcitoascii(char *dst, wint_t *src) +{ + while ((*dst++ = *src++)); +} + /* like wcslen, just for wint_t */ static inline size_t wcilen (const wint_t *wcs)