s/REQUIRE/ISC_REQUIRE/; include <isc/assertions.h> if ISC_REQUIRE is used; include <isc/likely.h> if ISC_{UN}LIKELY is used

This commit is contained in:
Mark Andrews
2017-10-19 16:39:53 +11:00
parent 583e355951
commit 0fab171196
4 changed files with 22 additions and 17 deletions

View File

@@ -13,6 +13,7 @@
/*! \file dns/rbt.h */
#include <isc/assertions.h>
#include <isc/crc64.h>
#include <isc/lang.h>
#include <isc/magic.h>
@@ -1077,7 +1078,7 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name);
} while (0)
#else /* DNS_RBT_USEISCREFCOUNT */
#define dns_rbtnode_refinit(node, n) ((node)->references = (n))
#define dns_rbtnode_refdestroy(node) REQUIRE((node)->references == 0)
#define dns_rbtnode_refdestroy(node) ISC_REQUIRE((node)->references == 0)
#define dns_rbtnode_refcurrent(node) ((node)->references)
#if (__STDC_VERSION__ + 0) >= 199901L || defined __GNUC__
@@ -1090,7 +1091,7 @@ dns_rbtnode_refincrement0(dns_rbtnode_t *node, unsigned int *refs) {
static inline void
dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) {
REQUIRE(node->references > 0);
ISC_REQUIRE(node->references > 0);
node->references++;
if (refs != NULL)
*refs = node->references;
@@ -1098,7 +1099,7 @@ dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) {
static inline void
dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) {
REQUIRE(node->references > 0);
ISC_REQUIRE(node->references > 0);
node->references--;
if (refs != NULL)
*refs = node->references;
@@ -1113,14 +1114,14 @@ dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) {
} while (0)
#define dns_rbtnode_refincrement(node, refs) \
do { \
REQUIRE((node)->references > 0); \
ISC_REQUIRE((node)->references > 0); \
(node)->references++; \
if ((refs) != NULL) \
(*refs) = (node)->references; \
} while (0)
#define dns_rbtnode_refdecrement(node, refs) \
do { \
REQUIRE((node)->references > 0); \
ISC_REQUIRE((node)->references > 0); \
(node)->references--; \
if ((refs) != NULL) \
(*refs) = (node)->references; \

View File

@@ -16,6 +16,7 @@
#define ISC_ASSERTIONS_H 1
#include <isc/lang.h>
#include <isc/likely.h>
#include <isc/platform.h>
ISC_LANG_BEGINDECLS

View File

@@ -96,8 +96,10 @@
*** Imports
***/
#include <isc/assertions.h>
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/likely.h>
#include <isc/magic.h>
#include <isc/types.h>
@@ -911,10 +913,10 @@ ISC_LANG_ENDDECLS
do { \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, _length) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= (unsigned int) _length); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= (unsigned int) _length); \
memmove(isc_buffer_used(_b), (_base), (_length)); \
(_b)->used += (_length); \
} while (0)
@@ -926,10 +928,10 @@ ISC_LANG_ENDDECLS
_length = strlen(_source); \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, _length) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= (unsigned int) _length); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= (unsigned int) _length); \
_cp = isc_buffer_used(_b); \
memmove(_cp, (_source), _length); \
(_b)->used += (_length); \
@@ -942,10 +944,10 @@ ISC_LANG_ENDDECLS
isc_uint8_t _val2 = (_val); \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, 1) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 1) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= 1U); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= 1U); \
_cp = isc_buffer_used(_b); \
(_b)->used++; \
_cp[0] = _val2; \
@@ -958,10 +960,10 @@ ISC_LANG_ENDDECLS
isc_uint16_t _val2 = (_val); \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, 2) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 2) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= 2U); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= 2U); \
_cp = isc_buffer_used(_b); \
(_b)->used += 2; \
_cp[0] = (unsigned char)(_val2 >> 8); \
@@ -975,10 +977,10 @@ ISC_LANG_ENDDECLS
isc_uint32_t _val2 = (_val); \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, 3) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 3) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= 3U); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= 3U); \
_cp = isc_buffer_used(_b); \
(_b)->used += 3; \
_cp[0] = (unsigned char)(_val2 >> 16); \
@@ -993,10 +995,10 @@ ISC_LANG_ENDDECLS
isc_uint32_t _val2 = (_val); \
if (ISC_UNLIKELY((_b)->autore)) { \
isc_buffer_t *_tmp = _b; \
REQUIRE(isc_buffer_reserve(&_tmp, 4) \
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 4) \
== ISC_R_SUCCESS); \
} \
REQUIRE(isc_buffer_availablelength(_b) >= 4U); \
ISC_REQUIRE(isc_buffer_availablelength(_b) >= 4U); \
_cp = isc_buffer_used(_b); \
(_b)->used += 4; \
_cp[0] = (unsigned char)(_val2 >> 24); \

View File

@@ -17,6 +17,7 @@
#include <isc/formatcheck.h>
#include <isc/lang.h>
#include <isc/likely.h>
#include <isc/platform.h>
ISC_LANG_BEGINDECLS