public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: wcitoascii: move to wchar.h as inline function
@ 2023-03-01  9:55 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-03-01  9:55 UTC (permalink / raw)
  To: cygwin-cvs

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-01  9:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01  9:55 [newlib-cygwin/main] Cygwin: wcitoascii: move to wchar.h as inline function Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).