This simplify header declaration for mbsinit() function.
---
mingw-w64-crt/Makefile.am | 1 +
mingw-w64-crt/misc/mbsinit.c | 1 -
mingw-w64-crt/misc/ucrt_mbsinit.c | 14 ++++++++++++++
mingw-w64-headers/crt/wchar.h | 10 +---------
4 files changed, 16 insertions(+), 10 deletions(-)
create mode 100644 mingw-w64-crt/misc/ucrt_mbsinit.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 494fe0f065ee..acf078eeaa0d 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -400,6 +400,7 @@ src_ucrtbase=\
misc/ucrt__wgetmainargs.c \
misc/ucrt_amsg_exit.c \
misc/ucrt_at_quick_exit.c \
+ misc/ucrt_mbsinit.c \
misc/ucrt_tzset.c \
math/_huge.c \
misc/__badioinfo.c \
diff --git a/mingw-w64-crt/misc/mbsinit.c b/mingw-w64-crt/misc/mbsinit.c
index d745402d7d61..a129f5441b23 100644
--- a/mingw-w64-crt/misc/mbsinit.c
+++ b/mingw-w64-crt/misc/mbsinit.c
@@ -15,7 +15,6 @@
*/
-#define __CRT__NO_INLINE
#include <wchar.h>
#if 0
diff --git a/mingw-w64-crt/misc/ucrt_mbsinit.c
b/mingw-w64-crt/misc/ucrt_mbsinit.c
new file mode 100644
index 000000000000..d653372986a0
--- /dev/null
+++ b/mingw-w64-crt/misc/ucrt_mbsinit.c
@@ -0,0 +1,14 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#undef __MSVCRT_VERSION__
+#define _UCRT
+#include <wchar.h>
+
+int __cdecl mbsinit(const mbstate_t *_P)
+{
+ return (!_P || _P->_Wchar == 0);
+}
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index cbe25c7ad6ec..5007968de03f 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -1153,6 +1153,7 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
typedef wchar_t _Wint_t;
wint_t __cdecl btowc(int);
+ int __cdecl mbsinit(const mbstate_t *ps);
size_t __cdecl mbrlen(const char * __restrict__ _Ch,size_t
_SizeInBytes,mbstate_t * __restrict__ _State);
size_t __cdecl mbrtowc(wchar_t * __restrict__ _DstCh,const char *
__restrict__ _SrcCh,size_t _SizeInBytes,mbstate_t * __restrict__ _State);
size_t __cdecl mbsrtowcs(wchar_t * __restrict__ _Dest,const char **
__restrict__ _PSrc,size_t _Count,mbstate_t * __restrict__ _State)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
@@ -1168,12 +1169,6 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
wchar_t * __cdecl wmempcpy (wchar_t *_Dst, const wchar_t *_Src, size_t
_Size);
wchar_t *__cdecl wmemmove(wchar_t *s1, const wchar_t *s2, size_t n)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
int __cdecl fwide(FILE *stream,int mode);
-#if defined(_UCRT) || defined(__LARGE_MBSTATE_T)
- /* With UCRT, mbsinit is only available as inline. */
- __mingw_ovr int __cdecl mbsinit(const mbstate_t *_P) { return (!_P ||
_P->_Wchar == 0); }
-#else
- int __cdecl mbsinit(const mbstate_t *ps);
-#endif
__MINGW_EXTENSION long long __cdecl wcstoll(const wchar_t * __restrict__
nptr,wchar_t ** __restrict__ endptr, int base);
__MINGW_EXTENSION unsigned long long __cdecl wcstoull(const wchar_t *
__restrict__ nptr,wchar_t ** __restrict__ endptr, int base);
#endif /* __NO_ISOCEXT */
@@ -1182,9 +1177,6 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
void *__cdecl memcpy(void * __restrict__ _Dst,const void * __restrict__
_Src,size_t _MaxCount) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
#ifndef __CRT__NO_INLINE
__CRT_INLINE int __cdecl fwide(FILE *_F,int _M) { (void)_F; return (_M); }
-#if !defined(_UCRT) && !defined(__LARGE_MBSTATE_T)
- __CRT_INLINE int __cdecl mbsinit(const mbstate_t *_P) { return (!_P ||
*_P==0); }
-#endif
__CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t
*_S,wchar_t _C,size_t _N) {
if (_S) {
for ( ; 0 < _N; ++_S, --_N)
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public