This commit removes following duplicate macros and/or typedefs:
1. _SIZE_T_DEFINED
2. _SSIZE_T_DEFINED
3. _WCTYPE_T_DEFINED

All are defined in <corecrt.h>. Note that <stddef.h> is not modified
here because it's much more complicated.

Also slightly simplified <tchar.h> by removing unnecessary
_CRT_BEGIN_C_HEADER and _CRT_END_C_HEADER macros.

Signed-off-by: Zhongteng Gui <[email protected]>
---
 mingw-w64-headers/crt/tchar.h                 | 30 ++++---------------
 mingw-w64-headers/crt/time.h                  | 20 -------------
 mingw-w64-headers/ddk/include/ddk/ntstrsafe.h | 10 -------
 mingw-w64-headers/include/rpcndr.h            | 20 -------------
 mingw-w64-headers/include/strsafe.h           | 20 -------------
 5 files changed, 6 insertions(+), 94 deletions(-)

diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index 059cc8337..cc0a954c1 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -12,8 +12,6 @@
 #error Need to include strsafe.h after tchar.h
 #endif
 
-_CRT_BEGIN_C_HEADER
-
 #ifndef __CYGWIN__
 
 #define _ftcscat _tcscat
@@ -72,22 +70,10 @@ _CRT_BEGIN_C_HEADER
 
 #ifdef _UNICODE
 
-_CRT_END_C_HEADER
-
 #include <wchar.h>
 
 _CRT_BEGIN_C_HEADER
 
-#ifndef __CYGWIN__
-
-#ifndef _WCTYPE_T_DEFINED
-#define _WCTYPE_T_DEFINED
-  typedef unsigned short wint_t;
-  typedef unsigned short wctype_t;
-#endif
-
-#endif /* __CYGWIN__ */
-
 #ifndef __TCHAR_DEFINED
 #define __TCHAR_DEFINED
   typedef wchar_t _TCHAR;
@@ -493,13 +479,11 @@ _CRT_BEGIN_C_HEADER
 
 #endif /* __CYGWIN__ */
 
-#else /* _UNICODE */
-
 _CRT_END_C_HEADER
 
-#include <string.h>
+#else /* _UNICODE */
 
-_CRT_BEGIN_C_HEADER
+#include <string.h>
 
 #define _TEOF EOF
 
@@ -783,14 +767,10 @@ _CRT_BEGIN_C_HEADER
 
 #ifdef _MBCS
 
-_CRT_END_C_HEADER
-
 #ifndef __CYGWIN__
 
 #include <mbstring.h>
 
-_CRT_BEGIN_C_HEADER
-
 #ifndef __TCHAR_DEFINED
   typedef char _TCHAR;
   typedef signed char _TSCHAR;
@@ -881,6 +861,8 @@ _CRT_BEGIN_C_HEADER
 #define _tccpy_l _mbccpy_l
 #else
 
+_CRT_BEGIN_C_HEADER
+
   _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int 
_Val);
   _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control);
   _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount);
@@ -942,6 +924,8 @@ _CRT_BEGIN_C_HEADER
   _CRTIMP size_t __cdecl _tclen(const char *_Str);
   _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh);
 
+_CRT_END_C_HEADER
+
 #ifdef __cplusplus
 #ifndef _CPP_TCHAR_INLINES_DEFINED
 #define _CPP_TCHAR_INLINES_DEFINED
@@ -1159,8 +1143,6 @@ _CRT_BEGIN_C_HEADER
 #define _T(x) __T(x)
 #define _TEXT(x) __T(x)
 
-_CRT_END_C_HEADER
-
 #ifndef __CYGWIN__
 #include <sec_api/tchar_s.h>
 #endif /* __CYGWIN__ */
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index bd19acfce..882859b86 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -22,26 +22,6 @@ _CRT_BEGIN_C_HEADER
   typedef long clock_t;
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-  __MINGW_EXTENSION typedef unsigned __int64 size_t;
-#else
-  typedef unsigned int size_t;
-#endif
-#endif
-
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-  __MINGW_EXTENSION typedef __int64 ssize_t;
-#else
-  typedef int ssize_t;
-#endif
-#endif
-
 #ifndef NULL
 #ifdef __cplusplus
 #ifndef _WIN64
diff --git a/mingw-w64-headers/ddk/include/ddk/ntstrsafe.h 
b/mingw-w64-headers/ddk/include/ddk/ntstrsafe.h
index 2b4a0a03e..e2106e3d5 100644
--- a/mingw-w64-headers/ddk/include/ddk/ntstrsafe.h
+++ b/mingw-w64-headers/ddk/include/ddk/ntstrsafe.h
@@ -16,16 +16,6 @@
 #define __STRSAFE__NO_INLINE
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-__MINGW_EXTENSION typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#endif
-
 #ifndef _NTSTATUS_DEFINED
 #define _NTSTATUS_DEFINED
 typedef __LONG32 NTSTATUS;
diff --git a/mingw-w64-headers/include/rpcndr.h 
b/mingw-w64-headers/include/rpcndr.h
index a7579c009..a7315eaf1 100644
--- a/mingw-w64-headers/include/rpcndr.h
+++ b/mingw-w64-headers/include/rpcndr.h
@@ -100,26 +100,6 @@ extern "C" {
 #define MIDL_uhyper /* __MINGW_EXTENSION */ unsigned __int64
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-  __MINGW_EXTENSION typedef unsigned __int64 size_t;
-#else
-  typedef unsigned int size_t;
-#endif
-#endif
-
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-  __MINGW_EXTENSION typedef __int64 ssize_t;
-#else
-  typedef int ssize_t;
-#endif
-#endif
-
 #ifdef __RPC_WIN32__
 #if defined(_ARM_)
 #define __RPC_CALLEE
diff --git a/mingw-w64-headers/include/strsafe.h 
b/mingw-w64-headers/include/strsafe.h
index 245078a09..c5314a823 100644
--- a/mingw-w64-headers/include/strsafe.h
+++ b/mingw-w64-headers/include/strsafe.h
@@ -16,26 +16,6 @@
 #define __STRSAFE__NO_INLINE
 #endif
 
-#ifndef _SIZE_T_DEFINED
-#define _SIZE_T_DEFINED
-#undef size_t
-#ifdef _WIN64
-__MINGW_EXTENSION typedef unsigned __int64 size_t;
-#else
-typedef unsigned int size_t;
-#endif
-#endif
-
-#ifndef _SSIZE_T_DEFINED
-#define _SSIZE_T_DEFINED
-#undef ssize_t
-#ifdef _WIN64
-__MINGW_EXTENSION typedef __int64 ssize_t;
-#else
-typedef int ssize_t;
-#endif
-#endif
-
 #ifndef _HRESULT_DEFINED
 #define _HRESULT_DEFINED
 typedef __LONG32 HRESULT;
-- 
2.55.0.windows.4



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to