public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin/main] struct _reent: add state for unicode functions
Date: Tue, 15 Aug 2023 20:35:44 +0000 (GMT)	[thread overview]
Message-ID: <20230815203544.6C2DD3856243@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b5111e46424b693e04bc0e964a01f871a71c26ef

commit b5111e46424b693e04bc0e964a01f871a71c26ef
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Tue Aug 15 22:30:59 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Tue Aug 15 22:30:59 2023 +0200

    struct _reent: add state for unicode functions
    
    C23 requires that the unicode functions c16rtomb, c8rtomb, mbrtoc16,
    mbrtoc32 and mbrtoc8 use their own internal state object.  c32rtomb
    only needs an internal state if the lib supports encoding with
    shift states, but that's the case for newlib and Cygwin.
    
    Only Cygwin implements these functions so add the states
    objects only for Cygwin for now.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/include/sys/reent.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index c71f75dbc28c..a6c923f1cf15 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -622,6 +622,14 @@ struct _reent
           _mbstate_t _wcrtomb_state;
           _mbstate_t _wcsrtombs_state;
 	  int _h_errno;
+#ifdef __CYGWIN__
+          _mbstate_t _c8rtomb_state;
+          _mbstate_t _c16rtomb_state;
+          _mbstate_t _c32rtomb_state;
+          _mbstate_t _mbrtoc8_state;
+          _mbstate_t _mbrtoc16_state;
+          _mbstate_t _mbrtoc32_state;
+#endif
         } _reent;
 #ifdef _REENT_BACKWARD_BINARY_COMPAT
       struct
@@ -730,6 +738,14 @@ struct _reent
 #define _REENT_MBSRTOWCS_STATE(ptr)((ptr)->_new._reent._mbsrtowcs_state)
 #define _REENT_WCRTOMB_STATE(ptr)((ptr)->_new._reent._wcrtomb_state)
 #define _REENT_WCSRTOMBS_STATE(ptr)((ptr)->_new._reent._wcsrtombs_state)
+#ifdef __CYGWIN__
+#  define _REENT_C8RTOMB_STATE(ptr)((ptr)->_new._reent._c8rtomb_state)
+#  define _REENT_C16RTOMB_STATE(ptr)((ptr)->_new._reent._c16rtomb_state)
+#  define _REENT_C32RTOMB_STATE(ptr)((ptr)->_new._reent._c32rtomb_state)
+#  define _REENT_MBRTOC8_STATE(ptr)((ptr)->_new._reent._mbrtoc8_state)
+#  define _REENT_MBRTOC16_STATE(ptr)((ptr)->_new._reent._mbrtoc16_state)
+#  define _REENT_MBRTOC32_STATE(ptr)((ptr)->_new._reent._mbrtoc32_state)
+#endif
 #define _REENT_L64A_BUF(ptr)    ((ptr)->_new._reent._l64a_buf)
 #define _REENT_SIGNAL_BUF(ptr)  ((ptr)->_new._reent._signal_buf)
 #define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_new._reent._getdate_err))

                 reply	other threads:[~2023-08-15 20:35 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=20230815203544.6C2DD3856243@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-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).