1a9643ea8Slogwang /*- 2*22ce4affSfengbojiang * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*22ce4affSfengbojiang * 4a9643ea8Slogwang * Copyright (c) 2003 Marcel Moolenaar 5a9643ea8Slogwang * All rights reserved. 6a9643ea8Slogwang * 7a9643ea8Slogwang * Redistribution and use in source and binary forms, with or without 8a9643ea8Slogwang * modification, are permitted provided that the following conditions 9a9643ea8Slogwang * are met: 10a9643ea8Slogwang * 11a9643ea8Slogwang * 1. Redistributions of source code must retain the above copyright 12a9643ea8Slogwang * notice, this list of conditions and the following disclaimer. 13a9643ea8Slogwang * 2. Redistributions in binary form must reproduce the above copyright 14a9643ea8Slogwang * notice, this list of conditions and the following disclaimer in the 15a9643ea8Slogwang * documentation and/or other materials provided with the distribution. 16a9643ea8Slogwang * 17a9643ea8Slogwang * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18a9643ea8Slogwang * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19a9643ea8Slogwang * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20a9643ea8Slogwang * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21a9643ea8Slogwang * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22a9643ea8Slogwang * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23a9643ea8Slogwang * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24a9643ea8Slogwang * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25a9643ea8Slogwang * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26a9643ea8Slogwang * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27a9643ea8Slogwang * 28a9643ea8Slogwang * $FreeBSD$ 29a9643ea8Slogwang */ 30a9643ea8Slogwang 31a9643ea8Slogwang #ifndef NULL 32a9643ea8Slogwang 33a9643ea8Slogwang #if !defined(__cplusplus) 34a9643ea8Slogwang #define NULL ((void *)0) 35a9643ea8Slogwang #else 36a9643ea8Slogwang #if __cplusplus >= 201103L 37a9643ea8Slogwang #define NULL nullptr 38a9643ea8Slogwang #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 39a9643ea8Slogwang #define NULL __null 40a9643ea8Slogwang #else 41a9643ea8Slogwang #if defined(__LP64__) 42a9643ea8Slogwang #define NULL (0L) 43a9643ea8Slogwang #else 44a9643ea8Slogwang #define NULL 0 45a9643ea8Slogwang #endif /* __LP64__ */ 46a9643ea8Slogwang #endif /* __GNUG__ */ 47a9643ea8Slogwang #endif /* !__cplusplus */ 48a9643ea8Slogwang 49a9643ea8Slogwang #endif 50