Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
2b74478c
Commit
2b74478c
authored
Aug 17, 2018
by
Ondřej Surý
Browse files
Remove check for atomic isc_refcount in dns/rbt.h and always use isc_refcount
parent
93e8ba1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/dns/include/dns/rbt.h
View file @
2b74478c
...
...
@@ -38,12 +38,6 @@ ISC_LANG_BEGINDECLS
#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
/*
...
...
@@ -164,13 +158,8 @@ struct dns_rbtnode {
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
/*@}*/
};
...
...
@@ -1059,7 +1048,6 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name);
* 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)); \
...
...
@@ -1082,58 +1070,6 @@ dns_rbtnodechain_nextflat(dns_rbtnodechain_t *chain, dns_name_t *name);
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
);
...
...
lib/dns/rbtdb.c
View file @
2b74478c
...
...
@@ -5489,14 +5489,16 @@ printnode(dns_db_t *db, dns_dbnode_t *node, FILE *out) {
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment