OSDN Git Service

Make strnlen() and wcsnlen() declaratively consistent.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 28 Jan 2017 17:46:36 +0000 (17:46 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 28 Jan 2017 17:46:36 +0000 (17:46 +0000)
mingwrt/ChangeLog
mingwrt/include/string.h

index 7bbe88c..59beea4 100644 (file)
@@ -1,5 +1,12 @@
 2017-01-28  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Make strnlen() and wcsnlen() declaratively consistent.
+
+       * include/string.h (strnlen): Do not expose its declaration, unless...
+       [_POSIX_C_SOURCE >= 200809L]: ...this feature test is enabled.
+
+2017-01-28  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        Implement wcsnlen() API per feature request [#2332].
 
        * mingwex/strnlen.s: Rename it as...
index 6cc4f88..a53a71a 100644 (file)
@@ -170,6 +170,7 @@ _CRTIMP __cdecl __MINGW_NOTHROW  void swab (const char *, char *, size_t);
 
 #endif /* ! __STRICT_ANSI__ */
 
+#if _POSIX_C_SOURCE >= 200809L
 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL
 /* MSVCR80.DLL adds a (mostly) POSIX.1-2008 conforming strnlen(); (it's
  * also available in MSVCRT.DLL from _WIN32_WINNT_VISTA onwards, but we
@@ -179,7 +180,7 @@ _CRTIMP __cdecl __MINGW_NOTHROW  void swab (const char *, char *, size_t);
  */
 _CRTIMP __cdecl __MINGW_NOTHROW  char *strnlen (const char *, size_t);
 
-#elif _POSIX_C_SOURCE >= 200809L
+#else  /* MSVCRT.DLL || pre-MSVCR80.DLL */
 /* Emulation, to support recent POSIX.1; we prefer this for ALL versions
  * of MSVCRT.DLL, (even those which already provide strnlen()); to avoid
  * the GCC breakage noted above.  (Note that we implement strnlen() with
@@ -194,6 +195,7 @@ __JMPSTUB__(( LIB=coldname; FUNCTION=strnlen ))
 __CRT_ALIAS size_t strnlen (const char *__text, size_t __maxlen)
 { return __mingw_strnlen (__text, __maxlen); }
 
+#endif /* MSVCRT.DLL || pre-MSVCR80.DLL */
 #endif /* _POSIX_C_SOURCE >= 200809L */
 
 #undef __STRING_H_SOURCED__