public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] struct _reent: add state for unicode functions
@ 2023-08-15 20:35 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-08-15 20:35 UTC (permalink / raw)
  To: newlib-cvs

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))

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

only message in thread, other threads:[~2023-08-15 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-15 20:35 [newlib-cygwin/main] struct _reent: add state for unicode functions 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).