From 486a4d93ed7e4e89385c60297f281ace34611712 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 27 Jul 2021 15:08:26 +0200 Subject: [PATCH] [CRT] Define NULL in crtdefs.h --- sdk/include/crt/crtdbg.h | 8 -------- sdk/include/crt/crtdefs.h | 8 ++++++++ sdk/include/crt/locale.h | 8 -------- sdk/include/crt/stddef.h | 9 --------- sdk/include/crt/stdio.h | 8 -------- sdk/include/crt/stdlib.h | 12 ------------ sdk/include/crt/string.h | 8 -------- sdk/include/crt/tchar.h | 8 -------- sdk/include/crt/time.h | 8 -------- sdk/include/crt/wchar.h | 8 -------- 10 files changed, 8 insertions(+), 77 deletions(-) diff --git a/sdk/include/crt/crtdbg.h b/sdk/include/crt/crtdbg.h index 9117025b6e2..9b72b56a60c 100644 --- a/sdk/include/crt/crtdbg.h +++ b/sdk/include/crt/crtdbg.h @@ -10,14 +10,6 @@ #pragma pack(push,_CRT_PACKING) -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/sdk/include/crt/crtdefs.h b/sdk/include/crt/crtdefs.h index 8ea3f85bdf5..d4ad5fd2178 100644 --- a/sdk/include/crt/crtdefs.h +++ b/sdk/include/crt/crtdefs.h @@ -9,6 +9,14 @@ #ifndef _INC_CRTDEFS #define _INC_CRTDEFS +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + #ifdef _USE_32BIT_TIME_T #ifdef _WIN64 #error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64 diff --git a/sdk/include/crt/locale.h b/sdk/include/crt/locale.h index f5cdc8a50fa..fff1376ce01 100644 --- a/sdk/include/crt/locale.h +++ b/sdk/include/crt/locale.h @@ -14,14 +14,6 @@ extern "C" { #endif -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE 2 diff --git a/sdk/include/crt/stddef.h b/sdk/include/crt/stddef.h index b5210fb9e92..1ff523e3a06 100644 --- a/sdk/include/crt/stddef.h +++ b/sdk/include/crt/stddef.h @@ -365,15 +365,6 @@ typedef __WCHAR_TYPE__ wchar_t; #endif /* __sys_stdtypes_h */ -/* A null pointer constant. */ -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void*)0) -#endif -#endif - #ifndef offsetof /* Offset of member MEMBER in a struct of type TYPE. */ diff --git a/sdk/include/crt/stdio.h b/sdk/include/crt/stdio.h index bff3578088d..9ac92d50672 100644 --- a/sdk/include/crt/stdio.h +++ b/sdk/include/crt/stdio.h @@ -66,14 +66,6 @@ extern "C" { #define _SYS_OPEN 20 #define TMP_MAX 32767 -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #ifndef _OFF_T_DEFINED #define _OFF_T_DEFINED #ifndef _OFF_T_ diff --git a/sdk/include/crt/stdlib.h b/sdk/include/crt/stdlib.h index 298b7ffad54..3985a547536 100644 --- a/sdk/include/crt/stdlib.h +++ b/sdk/include/crt/stdlib.h @@ -15,18 +15,6 @@ extern "C" { #endif -#ifndef NULL -#ifdef __cplusplus -#ifndef _WIN64 -#define NULL 0 -#else -#define NULL 0LL -#endif /* W64 */ -#else -#define NULL ((void *)0) -#endif -#endif - #ifndef MB_LEN_MAX #define MB_LEN_MAX 5 #endif diff --git a/sdk/include/crt/string.h b/sdk/include/crt/string.h index caeb23fcdc9..23cf26a9ce1 100644 --- a/sdk/include/crt/string.h +++ b/sdk/include/crt/string.h @@ -17,14 +17,6 @@ extern "C" { #define _NLSCMPERROR 2147483647 #endif -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #ifndef _CRT_MEMORY_DEFINED #define _CRT_MEMORY_DEFINED diff --git a/sdk/include/crt/tchar.h b/sdk/include/crt/tchar.h index d246b00e4c4..5143e5961a8 100644 --- a/sdk/include/crt/tchar.h +++ b/sdk/include/crt/tchar.h @@ -1513,14 +1513,6 @@ extern "C" { #define _istlegal(_c) (1) -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #define _strdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) #define _strinc(_pc) ((_pc)+1) #define _strnextc(_cpc) ((unsigned int) *(const unsigned char *)(_cpc)) diff --git a/sdk/include/crt/time.h b/sdk/include/crt/time.h index d712a396372..680c7fd2a1a 100644 --- a/sdk/include/crt/time.h +++ b/sdk/include/crt/time.h @@ -63,14 +63,6 @@ extern "C" { #endif #endif -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #ifndef _TM_DEFINED #define _TM_DEFINED struct tm { diff --git a/sdk/include/crt/wchar.h b/sdk/include/crt/wchar.h index f708917ace3..6c0f148b343 100644 --- a/sdk/include/crt/wchar.h +++ b/sdk/include/crt/wchar.h @@ -128,14 +128,6 @@ extern "C" { #define _WFINDDATA_T_DEFINED #endif /* !_WFINDDATA_T_DEFINED */ -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - #ifndef _CRT_CTYPEDATA_DEFINED # define _CRT_CTYPEDATA_DEFINED # ifndef _CTYPE_DISABLE_MACROS