[newlib-cygwin/main] Cygwin: wcitoascii: move to wchar.h as inline function
Corinna Vinschen
corinna@sourceware.org
Wed Mar 1 09:55:21 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=77883ac914939e3fd5b3001b78857a3d11942104
commit 77883ac914939e3fd5b3001b78857a3d11942104
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Wed Mar 1 10:34:41 2023 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Wed Mar 1 10:54:52 2023 +0100
Cygwin: wcitoascii: move to wchar.h as inline function
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
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 63a07a930f06..0b85a147acb7 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 3907732a260f..b09d014c04df 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)
More information about the Cygwin-cvs
mailing list