From de172e7c0cd33a752cda4bafd1fbb327a40b9983 Mon Sep 17 00:00:00 2001 From: espie <> Date: Fri, 11 Jun 1999 22:47:48 +0000 Subject: [PATCH] Define NULL to be __null for C++: better quality of implementation. __null is a magic constant of integral type that converts to a null pointer as should be, but warns for ambiguity when used to resolved an overload between an integral type and a pointer type. --- src/include/dirent.h | 6 +++++- src/include/locale.h | 6 +++++- src/include/stddef.h | 6 +++++- src/include/stdlib.h | 6 +++++- src/include/time.h | 6 +++++- src/include/unistd.h | 6 +++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/include/dirent.h b/src/include/dirent.h index 6023a5db..89718362 100644 --- a/src/include/dirent.h +++ b/src/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.4 1998/11/20 11:18:25 d Exp $ */ +/* $OpenBSD: dirent.h,v 1.5 1999/06/11 22:47:48 espie Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -82,8 +82,12 @@ typedef struct _dirdesc { #define __DTF_READALL 0x0008 /* everything has been read */ #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 #endif +#endif #endif /* _POSIX_SOURCE */ diff --git a/src/include/locale.h b/src/include/locale.h index 211b4dbb..5644acbd 100644 --- a/src/include/locale.h +++ b/src/include/locale.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locale.h,v 1.2 1997/09/21 10:45:41 niklas Exp $ */ +/* $OpenBSD: locale.h,v 1.3 1999/06/11 22:47:48 espie Exp $ */ /* $NetBSD: locale.h,v 1.6 1994/10/26 00:56:02 cgd Exp $ */ /* @@ -61,8 +61,12 @@ struct lconv { }; #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 #endif +#endif #define LC_ALL 0 #define LC_COLLATE 1 diff --git a/src/include/stddef.h b/src/include/stddef.h index 487528c6..0fcca4fb 100644 --- a/src/include/stddef.h +++ b/src/include/stddef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stddef.h,v 1.2 1997/09/21 10:45:52 niklas Exp $ */ +/* $OpenBSD: stddef.h,v 1.3 1999/06/11 22:47:48 espie Exp $ */ /* $NetBSD: stddef.h,v 1.4 1994/10/26 00:56:26 cgd Exp $ */ /*- @@ -54,8 +54,12 @@ typedef _BSD_WCHAR_T_ wchar_t; #endif #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 #endif +#endif #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index e2671421..286ebd48 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.9 1999/02/25 21:40:15 millert Exp $ */ +/* $OpenBSD: stdlib.h,v 1.10 1999/06/11 22:47:48 espie Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -73,8 +73,12 @@ typedef struct { #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 #endif +#endif #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 diff --git a/src/include/time.h b/src/include/time.h index 47562bc8..b1754e83 100644 --- a/src/include/time.h +++ b/src/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.6 1999/05/14 23:18:54 aaron Exp $ */ +/* $OpenBSD: time.h,v 1.7 1999/06/11 22:47:48 espie Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -48,8 +48,12 @@ #include #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 #endif +#endif #ifdef _BSD_CLOCK_T_ typedef _BSD_CLOCK_T_ clock_t; diff --git a/src/include/unistd.h b/src/include/unistd.h index 0d2b3044..449295d9 100644 --- a/src/include/unistd.h +++ b/src/include/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.25 1999/05/22 23:49:48 weingart Exp $ */ +/* $OpenBSD: unistd.h,v 1.26 1999/06/11 22:47:47 espie Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -48,8 +48,12 @@ #define STDERR_FILENO 2 /* standard error file descriptor */ #ifndef NULL +#ifdef __GNUG__ +#define NULL __null +#else #define NULL 0 /* null pointer constant */ #endif +#endif __BEGIN_DECLS __dead void _exit __P((int)) __attribute__((noreturn));