summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/dirent.h6
-rw-r--r--include/locale.h6
-rw-r--r--include/rpc/types.h4
-rw-r--r--include/stddef.h5
-rw-r--r--include/stdio.h5
-rw-r--r--include/stdlib.h5
-rw-r--r--include/string.h5
-rw-r--r--include/time.h5
-rw-r--r--include/unistd.h5
-rw-r--r--include/wchar.h5
-rw-r--r--sys/rpc/types.h4
-rw-r--r--sys/sys/_null.h37
-rw-r--r--sys/sys/param.h6
-rw-r--r--sys/sys/stddef.h5
14 files changed, 53 insertions, 50 deletions
diff --git a/include/dirent.h b/include/dirent.h
index f6e4ccd..d686daf 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -54,6 +54,8 @@
#if __BSD_VISIBLE
+#include <sys/_null.h>
+
/* definitions for library routines operating on directories. */
#define DIRBLKSIZ 1024
@@ -81,10 +83,6 @@ typedef struct _dirdesc {
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
#define __DTF_READALL 0x0008 /* everything has been read */
-#ifndef NULL
-#define NULL 0
-#endif
-
#else /* !__BSD_VISIBLE */
typedef void * DIR;
diff --git a/include/locale.h b/include/locale.h
index 2477db4..ba702140 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -37,6 +37,8 @@
#ifndef _LOCALE_H_
#define _LOCALE_H_
+#include <sys/_null.h>
+
struct lconv {
char *decimal_point;
char *thousands_sep;
@@ -64,10 +66,6 @@ struct lconv {
char int_n_sign_posn;
};
-#ifndef NULL
-#define NULL 0
-#endif
-
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
diff --git a/include/rpc/types.h b/include/rpc/types.h
index 4a5c656..58d22a8 100644
--- a/include/rpc/types.h
+++ b/include/rpc/types.h
@@ -40,6 +40,7 @@
#define _RPC_TYPES_H
#include <sys/types.h>
+#include <sys/_null.h>
typedef int32_t bool_t;
typedef int32_t enum_t;
@@ -59,9 +60,6 @@ typedef int32_t rpc_inline_t;
#ifndef TRUE
# define TRUE (1)
#endif
-#ifndef NULL
-# define NULL 0
-#endif
#define mem_alloc(bsize) calloc(1, bsize)
#define mem_free(ptr, bsize) free(ptr)
diff --git a/include/stddef.h b/include/stddef.h
index e9f5a84..dd73621 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -39,6 +39,7 @@
#define _STDDEF_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
typedef __ptrdiff_t ptrdiff_t;
@@ -62,10 +63,6 @@ typedef __wchar_t wchar_t;
#endif
#endif
-#ifndef NULL
-#define NULL 0
-#endif
-
#define offsetof(type, member) __offsetof(type, member)
#endif /* _STDDEF_H_ */
diff --git a/include/stdio.h b/include/stdio.h
index 72f07ea..58f4995 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -41,6 +41,7 @@
#define _STDIO_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
typedef __off_t fpos_t;
@@ -57,10 +58,6 @@ typedef __va_list va_list;
#endif
#endif
-#ifndef NULL
-#define NULL 0
-#endif
-
#define _FSTDIO /* Define for new stdio with functions. */
/*
diff --git a/include/stdlib.h b/include/stdlib.h
index 39dc469..23e6409 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -38,6 +38,7 @@
#define _STDLIB_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
#if __BSD_VISIBLE
@@ -69,10 +70,6 @@ typedef struct {
long rem;
} ldiv_t;
-#ifndef NULL
-#define NULL 0
-#endif
-
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
diff --git a/include/string.h b/include/string.h
index 3580e8d..9a38656 100644
--- a/include/string.h
+++ b/include/string.h
@@ -38,6 +38,7 @@
#define _STRING_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
/*
@@ -53,10 +54,6 @@ typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
-#ifndef NULL
-#define NULL 0
-#endif
-
__BEGIN_DECLS
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
void *memccpy(void * __restrict, const void * __restrict, int, size_t);
diff --git a/include/time.h b/include/time.h
index c7ba4f0..7a10790 100644
--- a/include/time.h
+++ b/include/time.h
@@ -46,6 +46,7 @@
#define _TIME_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
@@ -59,10 +60,6 @@
/* Frequency of the clock ticks reported by clock(). */
#define CLOCKS_PER_SEC 128
-#ifndef NULL
-#define NULL 0
-#endif
-
#ifndef _CLOCK_T_DECLARED
typedef __clock_t clock_t;
#define _CLOCK_T_DECLARED
diff --git a/include/unistd.h b/include/unistd.h
index 8cd8edc..da1438a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -40,6 +40,7 @@
#include <sys/cdefs.h>
#include <sys/types.h> /* XXX adds too much pollution. */
#include <sys/unistd.h>
+#include <sys/_null.h>
#include <sys/_types.h>
#ifndef _GID_T_DECLARED
@@ -81,10 +82,6 @@ typedef __useconds_t useconds_t;
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
-#ifndef NULL
-#define NULL 0 /* null pointer constant */
-#endif
-
#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
#define F_ULOCK 0 /* unlock locked section */
#define F_LOCK 1 /* lock a section for exclusive use */
diff --git a/include/wchar.h b/include/wchar.h
index 2b51040..b8bb90a 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -68,13 +68,10 @@
#define _WCHAR_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <sys/_types.h>
#include <machine/_limits.h>
-#ifndef NULL
-#define NULL 0
-#endif
-
#ifndef _MBSTATE_T_DECLARED
typedef __mbstate_t mbstate_t;
#define _MBSTATE_T_DECLARED
diff --git a/sys/rpc/types.h b/sys/rpc/types.h
index 4a5c656..58d22a8 100644
--- a/sys/rpc/types.h
+++ b/sys/rpc/types.h
@@ -40,6 +40,7 @@
#define _RPC_TYPES_H
#include <sys/types.h>
+#include <sys/_null.h>
typedef int32_t bool_t;
typedef int32_t enum_t;
@@ -59,9 +60,6 @@ typedef int32_t rpc_inline_t;
#ifndef TRUE
# define TRUE (1)
#endif
-#ifndef NULL
-# define NULL 0
-#endif
#define mem_alloc(bsize) calloc(1, bsize)
#define mem_free(ptr, bsize) free(ptr)
diff --git a/sys/sys/_null.h b/sys/sys/_null.h
new file mode 100644
index 0000000..682fea4
--- /dev/null
+++ b/sys/sys/_null.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef NULL
+
+#ifdef __LP64__
+#define NULL 0L
+#else
+#define NULL 0
+#endif
+
+#endif
diff --git a/sys/sys/param.h b/sys/sys/param.h
index cf423ba..28b18e8 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -42,6 +42,8 @@
#ifndef _SYS_PARAM_H_
#define _SYS_PARAM_H_
+#include <sys/_null.h>
+
#define BSD 199506 /* System version (year & month). */
#define BSD4_3 1
#define BSD4_4 1
@@ -59,10 +61,6 @@
#undef __FreeBSD_version
#define __FreeBSD_version 502100 /* Master, propagated to newvers */
-#ifndef NULL
-#define NULL 0
-#endif
-
#ifndef LOCORE
#include <sys/types.h>
#endif
diff --git a/sys/sys/stddef.h b/sys/sys/stddef.h
index 4104564..8e7f206 100644
--- a/sys/sys/stddef.h
+++ b/sys/sys/stddef.h
@@ -30,14 +30,11 @@
#define _SYS_STDDEF_H_
#include <sys/cdefs.h>
+#include <sys/_null.h>
#include <machine/_types.h>
typedef __ptrdiff_t ptrdiff_t;
#define offsetof(type, field) __offsetof(type, field)
-#ifndef NULL
-#define NULL 0
-#endif
-
#endif /* !_SYS_STDDEF_H_ */
OpenPOWER on IntegriCloud