+2020-03-12 Keith Marshall <keith@users.osdn.me>
+
+ Rationalize implementations of fwide() and mbsinit() functions.
+
+ * include/wchar.h (mbsinit): Mark as __LIBIMPL__; reimplement its
+ inline definition, to evaluate its mbstate_t reference argument.
+ (fwide): Mark as __LIBIMPL__.
+
+ * Makefile.in (libmingwex.a): Remove explicit dependencies on...
+ (fwide, mbsinit): ...these; they are implied by __LIBIMPL__ marks.
+
+ * mingwex/fwide.c mingwex/mbsinit.c: Redundant files; delete them.
+
2020-03-11 Keith Marshall <keith@users.osdn.me>
Correct a defect in detection of failed btowc() conversions.
vpath %.s ${mingwrt_srcdir}/mingwex
vpath %.sx ${mingwrt_srcdir}/mingwex
-libmingwex.a: $(addsuffix .$(OBJEXT), codeset fwide mbrconv mbrscan mbrlen)
-libmingwex.a: $(addsuffix .$(OBJEXT), mbrtowc mbsrtowcs mbsinit strnlen wcharmap)
+libmingwex.a: $(addsuffix .$(OBJEXT), codeset mbrconv mbrscan mbrlen)
+libmingwex.a: $(addsuffix .$(OBJEXT), mbrtowc mbsrtowcs strnlen wcharmap)
libmingwex.a: $(addsuffix .$(OBJEXT), wcrtomb wcsrtombs wcsnlen wcstod wcstof)
libmingwex.a: $(addsuffix .$(OBJEXT), wcstofp wcstold wctob wctrans wctype)
libmingwex.a: $(addsuffix .$(OBJEXT), wmemchr wmemcmp wmemcpy wmemmove wmemset)
__cdecl __MINGW_NOTHROW int mbsinit (const mbstate_t *);
#ifndef __NO_INLINE__
-__CRT_INLINE __cdecl __MINGW_NOTHROW
-int fwide (FILE *__UNUSED_PARAM(stream), int mode)
- { return mode; } /* Nothing to do */
+__CRT_INLINE __LIBIMPL__(( FUNCTION = fwide ))
+__cdecl __MINGW_NOTHROW int fwide (FILE *__UNUSED_PARAM(__stream), int __mode)
+{ return __mode; } /* Nothing to do */
-__CRT_INLINE __cdecl __MINGW_NOTHROW
-int mbsinit (const mbstate_t *__UNUSED_PARAM(ps))
- { return 1; }
+__CRT_INLINE __LIBIMPL__(( FUNCTION = mbsinit ))
+__cdecl __MINGW_NOTHROW int mbsinit (const mbstate_t *__ps)
+{ return ((__ps == NULL) || (*__ps == (mbstate_t)(0))); }
#endif
__cdecl __MINGW_NOTHROW wchar_t *wmemset (wchar_t *, wchar_t, size_t);
+++ /dev/null
-#include <wchar.h>
-#include <stdio.h>
-
-int
-fwide(FILE* stream, int mode)
-{
- return mode; /* Nothing to do. */
-}
-
+++ /dev/null
-/* This source code was extracted from the Q8 package created and placed
- in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
- last edit: 1999/11/05 gwyn@arl.mil
-
- Implements subclause 7.24 of ISO/IEC 9899:1999 (E).
-
- It supports an encoding where all char codes are mapped
- to the *same* code values within a wchar_t or wint_t,
- so long as no other wchar_t codes are used by the program.
-
-*/
-
-#include <wchar.h>
-
-int
-mbsinit(ps)
- const mbstate_t *ps;
- {
- return 1; /* don't have shift states */
- }
-