| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: util.h,v 1.12 2016/05/26 16:50:00 christos Exp $ */ | | 1 | /* $NetBSD: util.h,v 1.13 2018/02/18 23:51:20 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 2004-2007, 2010-2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") | | 4 | * Copyright (C) 2004-2007, 2010-2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") |
5 | * Copyright (C) 1998-2001 Internet Software Consortium. | | 5 | * Copyright (C) 1998-2001 Internet Software Consortium. |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify, and/or distribute this software for any | | 7 | * Permission to use, copy, modify, and/or distribute this software for any |
8 | * purpose with or without fee is hereby granted, provided that the above | | 8 | * purpose with or without fee is hereby granted, provided that the above |
9 | * copyright notice and this permission notice appear in all copies. | | 9 | * copyright notice and this permission notice appear in all copies. |
10 | * | | 10 | * |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH | | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH |
12 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | | 12 | * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
13 | * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, | | 13 | * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, |
14 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | | 14 | * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| @@ -69,27 +69,27 @@ | | | @@ -69,27 +69,27 @@ |
69 | * situation. | | 69 | * situation. |
70 | */ | | 70 | */ |
71 | #define DE_CONST(konst, var) \ | | 71 | #define DE_CONST(konst, var) \ |
72 | do { \ | | 72 | do { \ |
73 | union { const void *k; void *v; } _u; \ | | 73 | union { const void *k; void *v; } _u; \ |
74 | _u.k = konst; \ | | 74 | _u.k = konst; \ |
75 | var = _u.v; \ | | 75 | var = _u.v; \ |
76 | } while (/*CONSTCOND*/0) | | 76 | } while (/*CONSTCOND*/0) |
77 | | | 77 | |
78 | /*% | | 78 | /*% |
79 | * Use this in translation units that would otherwise be empty, to | | 79 | * Use this in translation units that would otherwise be empty, to |
80 | * suppress compiler warnings. | | 80 | * suppress compiler warnings. |
81 | */ | | 81 | */ |
82 | #define EMPTY_TRANSLATION_UNIT static void __used isc__empty(void) { isc__empty(); } | | 82 | #define EMPTY_TRANSLATION_UNIT static void __used isc__empty(int level) { if (level++ < 100) isc__empty(level); } |
83 | | | 83 | |
84 | /*% | | 84 | /*% |
85 | * We use macros instead of calling the routines directly because | | 85 | * We use macros instead of calling the routines directly because |
86 | * the capital letters make the locking stand out. | | 86 | * the capital letters make the locking stand out. |
87 | * We RUNTIME_CHECK for success since in general there's no way | | 87 | * We RUNTIME_CHECK for success since in general there's no way |
88 | * for us to continue if they fail. | | 88 | * for us to continue if they fail. |
89 | */ | | 89 | */ |
90 | | | 90 | |
91 | #ifdef ISC_UTIL_TRACEON | | 91 | #ifdef ISC_UTIL_TRACEON |
92 | #define ISC_UTIL_TRACE(a) a | | 92 | #define ISC_UTIL_TRACE(a) a |
93 | #include <stdio.h> /* Required for fprintf/stderr when tracing. */ | | 93 | #include <stdio.h> /* Required for fprintf/stderr when tracing. */ |
94 | #include <isc/msgs.h> /* Required for isc_msgcat when tracing. */ | | 94 | #include <isc/msgs.h> /* Required for isc_msgcat when tracing. */ |
95 | #else | | 95 | #else |