OSDN Git Service

Rationalize implementations of fwide() and mbsinit() functions.
authorKeith Marshall <keith@users.osdn.me>
Thu, 12 Mar 2020 22:44:03 +0000 (22:44 +0000)
committerKeith Marshall <keith@users.osdn.me>
Thu, 12 Mar 2020 22:44:03 +0000 (22:44 +0000)
mingwrt/ChangeLog
mingwrt/Makefile.in
mingwrt/include/wchar.h
mingwrt/mingwex/fwide.c [deleted file]
mingwrt/mingwex/mbsinit.c [deleted file]

index 411fd49..fb57462 100644 (file)
@@ -1,3 +1,16 @@
+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.
index fb25113..0ac94ee 100644 (file)
@@ -468,8 +468,8 @@ libmingwex.a: $(addsuffix .$(OBJEXT), mkstemp mkdtemp cryptnam setenv)
 
 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)
index 8a79dbc..bb8b0b7 100644 (file)
@@ -667,13 +667,13 @@ __cdecl __MINGW_NOTHROW  int fwide (FILE *, int);
 __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);
diff --git a/mingwrt/mingwex/fwide.c b/mingwrt/mingwex/fwide.c
deleted file mode 100644 (file)
index 79d5848..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include       <wchar.h>
-#include       <stdio.h>
-
-int
-fwide(FILE* stream, int mode)
-{
-  return mode; /* Nothing to do.  */
-}
-
diff --git a/mingwrt/mingwex/mbsinit.c b/mingwrt/mingwex/mbsinit.c
deleted file mode 100644 (file)
index c130afe..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*     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 */
-       }
-