#define DNS_RBTFIND_NOPREDECESSOR 0x04
/*@}*/
-#ifndef DNS_RBT_USEISCREFCOUNT
-#ifdef ISC_REFCOUNT_HAVEATOMIC
-#define DNS_RBT_USEISCREFCOUNT 1
-#endif
-#endif
-
#define DNS_RBT_USEMAGIC 1
/*
unsigned int dirty:1;
unsigned int wild:1;
unsigned int locknum:DNS_RBT_LOCKLENGTH;
-#ifndef DNS_RBT_USEISCREFCOUNT
- unsigned int references:DNS_RBT_REFLENGTH;
-#endif
unsigned int :0; /* end of bitfields c/o node lock */
-#ifdef DNS_RBT_USEISCREFCOUNT
isc_refcount_t references; /* note that this is not in the bitfield */
-#endif
/*@}*/
};
* The following macros provide a common interface to these operations,
* hiding the back-end. The usage is the same as that of isc_refcount_xxx().
*/
-#ifdef DNS_RBT_USEISCREFCOUNT
#define dns_rbtnode_refinit(node, n) \
do { \
isc_refcount_init(&(node)->references, (n)); \
do { \
isc_refcount_decrement(&(node)->references, (refs)); \
} while (0)
-#else /* DNS_RBT_USEISCREFCOUNT */
-#define dns_rbtnode_refinit(node, n) ((node)->references = (n))
-#define dns_rbtnode_refdestroy(node) ISC_REQUIRE((node)->references == 0)
-#define dns_rbtnode_refcurrent(node) ((node)->references)
-
-#if (__STDC_VERSION__ + 0) >= 199901L || defined __GNUC__
-static inline void
-dns_rbtnode_refincrement0(dns_rbtnode_t *node, unsigned int *refs) {
- node->references++;
- if (refs != NULL)
- *refs = node->references;
-}
-
-static inline void
-dns_rbtnode_refincrement(dns_rbtnode_t *node, unsigned int *refs) {
- ISC_REQUIRE(node->references > 0);
- node->references++;
- if (refs != NULL)
- *refs = node->references;
-}
-
-static inline void
-dns_rbtnode_refdecrement(dns_rbtnode_t *node, unsigned int *refs) {
- ISC_REQUIRE(node->references > 0);
- node->references--;
- if (refs != NULL)
- *refs = node->references;
-}
-#else
-#define dns_rbtnode_refincrement0(node, refs) \
- do { \
- unsigned int *_tmp = (unsigned int *)(refs); \
- (node)->references++; \
- if ((_tmp) != NULL) \
- (*_tmp) = (node)->references; \
- } while (0)
-#define dns_rbtnode_refincrement(node, refs) \
- do { \
- ISC_REQUIRE((node)->references > 0); \
- (node)->references++; \
- if ((refs) != NULL) \
- (*refs) = (node)->references; \
- } while (0)
-#define dns_rbtnode_refdecrement(node, refs) \
- do { \
- ISC_REQUIRE((node)->references > 0); \
- (node)->references--; \
- if ((refs) != NULL) \
- (*refs) = (node)->references; \
- } while (0)
-#endif
-#endif /* DNS_RBT_USEISCREFCOUNT */
void
dns_rbtnode_nodename(dns_rbtnode_t *node, dns_name_t *name);
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
dns_rbtnode_t *rbtnode = node;
bool first;
+ uint32_t refs;
REQUIRE(VALID_RBTDB(rbtdb));
NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
isc_rwlocktype_read);
- fprintf(out, "node %p, %u references, locknum = %u\n",
- rbtnode, dns_rbtnode_refcurrent(rbtnode),
+ refs = dns_rbtnode_refcurrent(rbtnode);
+ fprintf(out, "node %p, %" PRIu32 " references, locknum = %u\n",
+ rbtnode, refs,
rbtnode->locknum);
if (rbtnode->data != NULL) {
rdatasetheader_t *current, *top_next;