[hackers] [scc] [libc] Define NULL in common headers || Quentin Rameau

From: <git_AT_suckless.org>
Date: Thu, 23 Feb 2017 20:06:23 +0100 (CET)

commit 33f6a64348fbdae4298a057cf134969f78a57f86
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Feb 23 20:02:20 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Thu Feb 23 20:05:51 2017 +0100

    [libc] Define NULL in common headers
    
    There's no need to define NULL per architecture, it'll be the same for
    all the ones we support.

diff --git a/libc/include/bits/amd64-sysv/arch/locale.h b/libc/include/bits/amd64-sysv/arch/locale.h
deleted file mode 100644
index 3b8a2eb..0000000
--- a/libc/include/bits/amd64-sysv/arch/locale.h
+++ /dev/null
_AT_@ -1,4 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
diff --git a/libc/include/bits/amd64-sysv/arch/stddef.h b/libc/include/bits/amd64-sysv/arch/stddef.h
index bd65fef..76ebb50 100644
--- a/libc/include/bits/amd64-sysv/arch/stddef.h
+++ b/libc/include/bits/amd64-sysv/arch/stddef.h
_AT_@ -1,16 +1,12 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #define _SIZET
 #endif
 
 #ifndef _WCHAR_T
-typedef short wchar_t;
+typedef short wchar_t;
 #define _WCHAR_T
 #endif
 
diff --git a/libc/include/bits/amd64-sysv/arch/stdio.h b/libc/include/bits/amd64-sysv/arch/stdio.h
index e67bf3c..a8b5b51 100644
--- a/libc/include/bits/amd64-sysv/arch/stdio.h
+++ b/libc/include/bits/amd64-sysv/arch/stdio.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/amd64-sysv/arch/stdlib.h b/libc/include/bits/amd64-sysv/arch/stdlib.h
index 94941c0..0708580 100644
--- a/libc/include/bits/amd64-sysv/arch/stdlib.h
+++ b/libc/include/bits/amd64-sysv/arch/stdlib.h
_AT_@ -5,10 +5,6 @@ typedef unsigned long size_t;
 #define _SIZET
 #endif
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
 
diff --git a/libc/include/bits/amd64-sysv/arch/string.h b/libc/include/bits/amd64-sysv/arch/string.h
index b46813a..c968556 100644
--- a/libc/include/bits/amd64-sysv/arch/string.h
+++ b/libc/include/bits/amd64-sysv/arch/string.h
_AT_@ -1,9 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #endif
diff --git a/libc/include/bits/amd64-sysv/arch/time.h b/libc/include/bits/amd64-sysv/arch/time.h
index 03a8863..56d9ff5 100644
--- a/libc/include/bits/amd64-sysv/arch/time.h
+++ b/libc/include/bits/amd64-sysv/arch/time.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/i386-sysv/arch/locale.h b/libc/include/bits/i386-sysv/arch/locale.h
deleted file mode 100644
index 3b8a2eb..0000000
--- a/libc/include/bits/i386-sysv/arch/locale.h
+++ /dev/null
_AT_@ -1,4 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
diff --git a/libc/include/bits/i386-sysv/arch/stddef.h b/libc/include/bits/i386-sysv/arch/stddef.h
index bd65fef..76ebb50 100644
--- a/libc/include/bits/i386-sysv/arch/stddef.h
+++ b/libc/include/bits/i386-sysv/arch/stddef.h
_AT_@ -1,16 +1,12 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #define _SIZET
 #endif
 
 #ifndef _WCHAR_T
-typedef short wchar_t;
+typedef short wchar_t;
 #define _WCHAR_T
 #endif
 
diff --git a/libc/include/bits/i386-sysv/arch/stdio.h b/libc/include/bits/i386-sysv/arch/stdio.h
index f411dc7..8aa88fa 100644
--- a/libc/include/bits/i386-sysv/arch/stdio.h
+++ b/libc/include/bits/i386-sysv/arch/stdio.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/i386-sysv/arch/stdlib.h b/libc/include/bits/i386-sysv/arch/stdlib.h
index 94941c0..0708580 100644
--- a/libc/include/bits/i386-sysv/arch/stdlib.h
+++ b/libc/include/bits/i386-sysv/arch/stdlib.h
_AT_@ -5,10 +5,6 @@ typedef unsigned long size_t;
 #define _SIZET
 #endif
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
 
diff --git a/libc/include/bits/i386-sysv/arch/string.h b/libc/include/bits/i386-sysv/arch/string.h
index b46813a..c968556 100644
--- a/libc/include/bits/i386-sysv/arch/string.h
+++ b/libc/include/bits/i386-sysv/arch/string.h
_AT_@ -1,9 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #endif
diff --git a/libc/include/bits/i386-sysv/arch/time.h b/libc/include/bits/i386-sysv/arch/time.h
index 03a8863..56d9ff5 100644
--- a/libc/include/bits/i386-sysv/arch/time.h
+++ b/libc/include/bits/i386-sysv/arch/time.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/qbe/arch/locale.h b/libc/include/bits/qbe/arch/locale.h
deleted file mode 100644
index 3b8a2eb..0000000
--- a/libc/include/bits/qbe/arch/locale.h
+++ /dev/null
_AT_@ -1,4 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
diff --git a/libc/include/bits/qbe/arch/stddef.h b/libc/include/bits/qbe/arch/stddef.h
index bd65fef..76ebb50 100644
--- a/libc/include/bits/qbe/arch/stddef.h
+++ b/libc/include/bits/qbe/arch/stddef.h
_AT_@ -1,16 +1,12 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #define _SIZET
 #endif
 
 #ifndef _WCHAR_T
-typedef short wchar_t;
+typedef short wchar_t;
 #define _WCHAR_T
 #endif
 
diff --git a/libc/include/bits/qbe/arch/stdio.h b/libc/include/bits/qbe/arch/stdio.h
index e67bf3c..a8b5b51 100644
--- a/libc/include/bits/qbe/arch/stdio.h
+++ b/libc/include/bits/qbe/arch/stdio.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/qbe/arch/stdlib.h b/libc/include/bits/qbe/arch/stdlib.h
index 94941c0..0708580 100644
--- a/libc/include/bits/qbe/arch/stdlib.h
+++ b/libc/include/bits/qbe/arch/stdlib.h
_AT_@ -5,10 +5,6 @@ typedef unsigned long size_t;
 #define _SIZET
 #endif
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
 
diff --git a/libc/include/bits/qbe/arch/string.h b/libc/include/bits/qbe/arch/string.h
index b46813a..c968556 100644
--- a/libc/include/bits/qbe/arch/string.h
+++ b/libc/include/bits/qbe/arch/string.h
_AT_@ -1,9 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned long size_t;
 #endif
diff --git a/libc/include/bits/qbe/arch/time.h b/libc/include/bits/qbe/arch/time.h
index 03a8863..56d9ff5 100644
--- a/libc/include/bits/qbe/arch/time.h
+++ b/libc/include/bits/qbe/arch/time.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned long size_t;
diff --git a/libc/include/bits/z80/arch/locale.h b/libc/include/bits/z80/arch/locale.h
deleted file mode 100644
index 3b8a2eb..0000000
--- a/libc/include/bits/z80/arch/locale.h
+++ /dev/null
_AT_@ -1,4 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
diff --git a/libc/include/bits/z80/arch/stddef.h b/libc/include/bits/z80/arch/stddef.h
index 7bced4a..5e1a46a 100644
--- a/libc/include/bits/z80/arch/stddef.h
+++ b/libc/include/bits/z80/arch/stddef.h
_AT_@ -1,9 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned size_t;
 #define _SIZET
diff --git a/libc/include/bits/z80/arch/stdio.h b/libc/include/bits/z80/arch/stdio.h
index 5e8f477..703d085 100644
--- a/libc/include/bits/z80/arch/stdio.h
+++ b/libc/include/bits/z80/arch/stdio.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned size_t;
diff --git a/libc/include/bits/z80/arch/stdlib.h b/libc/include/bits/z80/arch/stdlib.h
index 11f9b16..931c68f 100644
--- a/libc/include/bits/z80/arch/stdlib.h
+++ b/libc/include/bits/z80/arch/stdlib.h
_AT_@ -5,10 +5,6 @@ typedef unsigned size_t;
 #define _SIZET
 #endif
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #define EXIT_FAILURE 1
 #define EXIT_SUCCESS 0
 
diff --git a/libc/include/bits/z80/arch/string.h b/libc/include/bits/z80/arch/string.h
index 3f462d2..5acff33 100644
--- a/libc/include/bits/z80/arch/string.h
+++ b/libc/include/bits/z80/arch/string.h
_AT_@ -1,9 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
 #ifndef _SIZET
 typedef unsigned size_t;
 #endif
diff --git a/libc/include/bits/z80/arch/time.h b/libc/include/bits/z80/arch/time.h
index 1436245..6614caf 100644
--- a/libc/include/bits/z80/arch/time.h
+++ b/libc/include/bits/z80/arch/time.h
_AT_@ -1,7 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
 
 #ifndef _SIZET
 typedef unsigned size_t;
diff --git a/libc/include/locale.h b/libc/include/locale.h
index b77c6dc..eea3be8 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
_AT_@ -1,7 +1,9 @@
 #ifndef _LOCALE_H
 #define _LOCALE_H
 
-#include <arch/locale.h>
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
 
 #define LC_ALL 0
 #define LC_COLLATE 1
diff --git a/libc/include/stddef.h b/libc/include/stddef.h
index e35309c..1132932 100644
--- a/libc/include/stddef.h
+++ b/libc/include/stddef.h
_AT_@ -4,6 +4,10 @@
 
 #include <arch/stddef.h>
 
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
 #define offsetof(st, m) ((size_t)&(((st *)0)->m))
 
 #endif
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 8eedf8b..a2a2a99 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
_AT_@ -4,6 +4,10 @@
 
 #include <arch/stdio.h>
 
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
 #define EOF -1
 #define _IOFBF 0
 #define _IOLBF 1
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 2b3052b..cf71bd2 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
_AT_@ -4,6 +4,10 @@
 
 #include <arch/stdlib.h>
 
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
 #define MB_CUR_MAX 1
 #define RAND_MAX 32767
 
diff --git a/libc/include/string.h b/libc/include/string.h
index d6b3d81..c729b19 100644
--- a/libc/include/string.h
+++ b/libc/include/string.h
_AT_@ -4,6 +4,10 @@
 
 #include <arch/string.h>
 
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
 extern void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
 extern void *memmove(void *s1, const void *s2, size_t n);
 extern char *strcpy(char * restrict s1, const char * restrict s2);
diff --git a/libc/include/time.h b/libc/include/time.h
index c820164..004931e 100644
--- a/libc/include/time.h
+++ b/libc/include/time.h
_AT_@ -3,6 +3,10 @@
 
 #include <arch/time.h>
 
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
 #define CLOCKS_PER_SEC 1000000
 
 typedef long int clock_t;
Received on Thu Feb 23 2017 - 20:06:23 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 23 2017 - 20:12:17 CET