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.
This commit is contained in:
pooka 2013-07-17 15:50:59 +00:00
parent d8748c5de0
commit 4a8002bb72
1 changed files with 12 additions and 3 deletions

View File

@ -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.
@ -82,6 +80,17 @@
* For details on the use of these macros, see the queue(3) manual page.
*/
/*
* 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.
*/