]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Make sure NULL is defined to be ((void *)0)
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 6 Feb 2017 08:55:40 +0000 (10:55 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 6 Feb 2017 14:37:13 +0000 (16:37 +0200)
This avoids us having to do explicit (void *)NULL casts in e.g.
io_add(..., NULL) context parameter.

src/lib/compat.h

index f6bb6e3526031035d29dcadc10b087cce91f8f37..937b09722be4e45a73486e36bab2450cbe800a9a 100644 (file)
 #  define LLONG_MAX 9223372036854775807LL
 #endif
 
+/* We really want NULL to be a pointer, since we have various type-checks
+   that may result in compiler warnings/errors if it's not. */
+#ifndef __cplusplus
+#  undef NULL
+#  define NULL ((void *)0)
+#endif
+
 #ifndef __cplusplus
 #ifdef HAVE__BOOL
 typedef _Bool bool;