Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Include sys/null.h only on NetBSD because sys/null.h...



details:   https://anonhg.NetBSD.org/src/rev/0f502d72f935
branches:  trunk
changeset: 787988:0f502d72f935
user:      pooka <pooka%NetBSD.org@localhost>
date:      Wed Jul 17 15:50:59 2013 +0000

description:
Include sys/null.h only on NetBSD because sys/null.h is not available
elsewhere.  This conditional makes the header portable and it can simply
be dropped verbatim into any system.

Also, move the inclusion below the comment block describing the purpose
of queue.h so that people looking at the header first see information
about the functionality instead of about a portability detail.

diffstat:

 sys/sys/queue.h |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 5249afe12fd1 -r 0f502d72f935 sys/sys/queue.h
--- a/sys/sys/queue.h   Wed Jul 17 15:42:03 2013 +0000
+++ b/sys/sys/queue.h   Wed Jul 17 15:50:59 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: queue.h,v 1.54 2013/04/10 22:22:16 christos Exp $      */
+/*     $NetBSD: queue.h,v 1.55 2013/07/17 15:50:59 pooka Exp $ */
 
 /*
  * Copyright (c) 1991, 1993
@@ -34,8 +34,6 @@
 #ifndef        _SYS_QUEUE_H_
 #define        _SYS_QUEUE_H_
 
-#include <sys/null.h>
-
 /*
  * This file defines five types of data structures: singly-linked lists,
  * lists, simple queues, tail queues, and circular queues.
@@ -83,6 +81,17 @@
  */
 
 /*
+ * Include the definition of NULL only on NetBSD because sys/null.h
+ * is not available elsewhere.  This conditional makes the header
+ * portable and it can simply be dropped verbatim into any system.
+ * The caveat is that on other systems some other header
+ * must provide NULL before the macros can be used.
+ */
+#ifdef __NetBSD__
+#include <sys/null.h>
+#endif
+
+/*
  * List definitions.
  */
 #define        LIST_HEAD(name, type)                                           \



Home | Main Index | Thread Index | Old Index