Browse Source

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.
OPENBSD_2_6
espie 25 years ago
parent
commit
de172e7c0c
6 changed files with 30 additions and 6 deletions
  1. +5
    -1
      src/include/dirent.h
  2. +5
    -1
      src/include/locale.h
  3. +5
    -1
      src/include/stddef.h
  4. +5
    -1
      src/include/stdlib.h
  5. +5
    -1
      src/include/time.h
  6. +5
    -1
      src/include/unistd.h

+ 5
- 1
src/include/dirent.h View File

@ -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 */


+ 5
- 1
src/include/locale.h View File

@ -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


+ 5
- 1
src/include/stddef.h View File

@ -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))


+ 5
- 1
src/include/stdlib.h View File

@ -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


+ 5
- 1
src/include/time.h View File

@ -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 <machine/ansi.h>
#ifndef NULL
#ifdef __GNUG__
#define NULL __null
#else
#define NULL 0
#endif
#endif
#ifdef _BSD_CLOCK_T_
typedef _BSD_CLOCK_T_ clock_t;


+ 5
- 1
src/include/unistd.h View File

@ -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));


Loading…
Cancel
Save