aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2024-02-05 10:38:28 +0100
committerCorinna Vinschen <corinna@vinschen.de>2024-02-05 10:38:28 +0100
commitbfb68a9e6e43bb6a7fbbaca3e1e18f6244eab6a3 (patch)
tree809b97dcd3513f133efa61292fb8c91ea23c7975
parent35b10bb8c6c0499202827cb6c52a01ce169ef98d (diff)
downloadnewlib-bfb68a9e6e43bb6a7fbbaca3e1e18f6244eab6a3.zip
newlib-bfb68a9e6e43bb6a7fbbaca3e1e18f6244eab6a3.tar.gz
newlib-bfb68a9e6e43bb6a7fbbaca3e1e18f6244eab6a3.tar.bz2
getlocalename_l: fix _reent for _REENT_SMALL targets
The new _MB_CAPABALE-only _misc_reent member getlocalename_l_buf was incorrectly initialized in the _REENT_INIT_MISC macro, so the build failed for _REENT_SMALL targets, independet of the _MB_CAPABALE setting. Fixes: 71511d4ac868 ("getlocalename_l: implement per SUS Base Specifications Issue 8 draft") Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--newlib/libc/include/sys/reent.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 4e60c30..0cba166 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -514,6 +514,11 @@ struct _reent
#define _REENT_CHECK_EMERGENCY(var) \
_REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
+#ifdef _MB_CAPABLE
+#define __REENT_INIT_MISC_GETLOCALENAME_L _r->_misc->_getlocalename_l_buf[0] = '\0'
+#else
+#define __REENT_INIT_MISC_GETLOCALENAME_L
+#endif
#define _REENT_INIT_MISC(var) do { \
struct _reent *_r = (var); \
_r->_misc->_strtok_last = _NULL; \
@@ -533,7 +538,7 @@ struct _reent
_r->_misc->_wcrtomb_state.__value.__wch = 0; \
_r->_misc->_wcsrtombs_state.__count = 0; \
_r->_misc->_wcsrtombs_state.__value.__wch = 0; \
- _r->_misc->_getlocale_l_buf[0] = '\0'; \
+ __REENT_INIT_MISC_GETLOCALENAME_L; \
_r->_misc->_l64a_buf[0] = '\0'; \
_r->_misc->_getdate_err = 0; \
} while (0)