public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Cygwin: wcitoascii: move to wchar.h as inline function
Date: Wed,  1 Mar 2023 09:55:21 +0000 (GMT)	[thread overview]
Message-ID: <20230301095521.865DF3858D33@sourceware.org> (raw)

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)

                 reply	other threads:[~2023-03-01  9:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230301095521.865DF3858D33@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).