mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 18:19:42 +00:00
Stop providing branch prediction information
The __builtin_expect() can be used to provide the compiler with branch prediction information. The Gcc manual says[1] on the subject: In general, you should prefer to use actual profile feedback for this (-fprofile-arcs), as programmers are notoriously bad at predicting how their programs actually perform. Stop using __builtin_expect() and ISC_LIKELY() and ISC_UNLIKELY() macros to provide the branch prediction information as the performance testing shows that named performs better when the __builtin_expect() is not being used. 1. https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fexpect
This commit is contained in:
parent
80fedf9231
commit
e603983ec9
@ -66,15 +66,6 @@ expression V;
|
|||||||
dns_message_create(...);
|
dns_message_create(...);
|
||||||
- CHECK(..., V);
|
- CHECK(..., V);
|
||||||
|
|
||||||
@@
|
|
||||||
expression V;
|
|
||||||
statement S;
|
|
||||||
@@
|
|
||||||
|
|
||||||
- V =
|
|
||||||
dns_message_create(...);
|
|
||||||
- if (ISC_UNLIKELY(V != ISC_R_SUCCESS)) S
|
|
||||||
|
|
||||||
@@
|
@@
|
||||||
expression V;
|
expression V;
|
||||||
@@
|
@@
|
||||||
|
@ -66,15 +66,6 @@ expression V;
|
|||||||
isc_buffer_allocate(...);
|
isc_buffer_allocate(...);
|
||||||
- CHECK(..., V);
|
- CHECK(..., V);
|
||||||
|
|
||||||
@@
|
|
||||||
expression V;
|
|
||||||
statement S;
|
|
||||||
@@
|
|
||||||
|
|
||||||
- V =
|
|
||||||
isc_buffer_allocate(...);
|
|
||||||
- if (ISC_UNLIKELY(V != ISC_R_SUCCESS)) S
|
|
||||||
|
|
||||||
@@
|
@@
|
||||||
expression V;
|
expression V;
|
||||||
@@
|
@@
|
||||||
|
@ -227,7 +227,7 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
REQUIRE(dns_name_isabsolute(name));
|
REQUIRE(dns_name_isabsolute(name));
|
||||||
REQUIRE(offset != NULL);
|
REQUIRE(offset != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY((cctx->allowed & DNS_COMPRESS_ENABLED) == 0)) {
|
if ((cctx->allowed & DNS_COMPRESS_ENABLED) == 0) {
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,16 +256,14 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
*/
|
*/
|
||||||
ch = p[1];
|
ch = p[1];
|
||||||
i = tableindex[ch];
|
i = tableindex[ch];
|
||||||
if (ISC_LIKELY((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) !=
|
if ((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0) {
|
||||||
0)) {
|
|
||||||
for (node = cctx->table[i]; node != NULL;
|
for (node = cctx->table[i]; node != NULL;
|
||||||
node = node->next) {
|
node = node->next) {
|
||||||
if (ISC_UNLIKELY(node->name.length != length)) {
|
if (node->name.length != length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_LIKELY(memcmp(node->name.ndata, p,
|
if (memcmp(node->name.ndata, p, length) == 0) {
|
||||||
length) == 0)) {
|
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,18 +274,18 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
unsigned char c;
|
unsigned char c;
|
||||||
unsigned char *label1, *label2;
|
unsigned char *label1, *label2;
|
||||||
|
|
||||||
if (ISC_UNLIKELY(node->name.length != length)) {
|
if (node->name.length != length) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
l = labels - n;
|
l = labels - n;
|
||||||
if (ISC_UNLIKELY(node->name.labels != l)) {
|
if (node->name.labels != l) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
label1 = node->name.ndata;
|
label1 = node->name.ndata;
|
||||||
label2 = p;
|
label2 = p;
|
||||||
while (ISC_LIKELY(l-- > 0)) {
|
while (l-- > 0) {
|
||||||
count = *label1++;
|
count = *label1++;
|
||||||
if (count != *label2++) {
|
if (count != *label2++) {
|
||||||
goto cont1;
|
goto cont1;
|
||||||
@ -297,7 +295,7 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
INSIST(count <= 63);
|
INSIST(count <= 63);
|
||||||
|
|
||||||
/* Loop unrolled for performance */
|
/* Loop unrolled for performance */
|
||||||
while (ISC_LIKELY(count > 3)) {
|
while (count > 3) {
|
||||||
c = maptolower[label1[0]];
|
c = maptolower[label1[0]];
|
||||||
if (c != maptolower[label2[0]])
|
if (c != maptolower[label2[0]])
|
||||||
{
|
{
|
||||||
@ -322,7 +320,7 @@ dns_compress_findglobal(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
label1 += 4;
|
label1 += 4;
|
||||||
label2 += 4;
|
label2 += 4;
|
||||||
}
|
}
|
||||||
while (ISC_LIKELY(count-- > 0)) {
|
while (count-- > 0) {
|
||||||
c = maptolower[*label1++];
|
c = maptolower[*label1++];
|
||||||
if (c != maptolower[*label2++])
|
if (c != maptolower[*label2++])
|
||||||
{
|
{
|
||||||
@ -388,7 +386,7 @@ dns_compress_add(dns_compress_t *cctx, const dns_name_t *name,
|
|||||||
REQUIRE(VALID_CCTX(cctx));
|
REQUIRE(VALID_CCTX(cctx));
|
||||||
REQUIRE(dns_name_isabsolute(name));
|
REQUIRE(dns_name_isabsolute(name));
|
||||||
|
|
||||||
if (ISC_UNLIKELY((cctx->allowed & DNS_COMPRESS_ENABLED) == 0)) {
|
if ((cctx->allowed & DNS_COMPRESS_ENABLED) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +487,7 @@ dns_compress_rollback(dns_compress_t *cctx, uint16_t offset) {
|
|||||||
|
|
||||||
REQUIRE(VALID_CCTX(cctx));
|
REQUIRE(VALID_CCTX(cctx));
|
||||||
|
|
||||||
if (ISC_UNLIKELY((cctx->allowed & DNS_COMPRESS_ENABLED) == 0)) {
|
if ((cctx->allowed & DNS_COMPRESS_ENABLED) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,7 +835,7 @@ dns_message_findtype(const dns_name_t *name, dns_rdatatype_t type,
|
|||||||
curr = ISC_LIST_PREV(curr, link))
|
curr = ISC_LIST_PREV(curr, link))
|
||||||
{
|
{
|
||||||
if (curr->type == type && curr->covers == covers) {
|
if (curr->type == type && curr->covers == covers) {
|
||||||
if (ISC_UNLIKELY(rdataset != NULL)) {
|
if (rdataset != NULL) {
|
||||||
*rdataset = curr;
|
*rdataset = curr;
|
||||||
}
|
}
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@ -2450,7 +2450,7 @@ dns_message_findname(dns_message_t *msg, dns_section_t section,
|
|||||||
/*
|
/*
|
||||||
* And now look for the type.
|
* And now look for the type.
|
||||||
*/
|
*/
|
||||||
if (ISC_UNLIKELY(type == dns_rdatatype_any)) {
|
if (type == dns_rdatatype_any) {
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
|
|||||||
REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
|
REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
|
||||||
(name2->attributes & DNS_NAMEATTR_ABSOLUTE));
|
(name2->attributes & DNS_NAMEATTR_ABSOLUTE));
|
||||||
|
|
||||||
if (ISC_UNLIKELY(name1 == name2)) {
|
if (name1 == name2) {
|
||||||
*orderp = 0;
|
*orderp = 0;
|
||||||
*nlabelsp = name1->labels;
|
*nlabelsp = name1->labels;
|
||||||
return (dns_namereln_equal);
|
return (dns_namereln_equal);
|
||||||
@ -537,7 +537,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
|
|||||||
offsets1 += l1;
|
offsets1 += l1;
|
||||||
offsets2 += l2;
|
offsets2 += l2;
|
||||||
|
|
||||||
while (ISC_LIKELY(l > 0)) {
|
while (l > 0) {
|
||||||
l--;
|
l--;
|
||||||
offsets1--;
|
offsets1--;
|
||||||
offsets2--;
|
offsets2--;
|
||||||
@ -560,7 +560,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Loop unrolled for performance */
|
/* Loop unrolled for performance */
|
||||||
while (ISC_LIKELY(count > 3)) {
|
while (count > 3) {
|
||||||
chdiff = (int)maptolower[label1[0]] -
|
chdiff = (int)maptolower[label1[0]] -
|
||||||
(int)maptolower[label2[0]];
|
(int)maptolower[label2[0]];
|
||||||
if (chdiff != 0) {
|
if (chdiff != 0) {
|
||||||
@ -589,7 +589,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
|
|||||||
label1 += 4;
|
label1 += 4;
|
||||||
label2 += 4;
|
label2 += 4;
|
||||||
}
|
}
|
||||||
while (ISC_LIKELY(count-- > 0)) {
|
while (count-- > 0) {
|
||||||
chdiff = (int)maptolower[*label1++] -
|
chdiff = (int)maptolower[*label1++] -
|
||||||
(int)maptolower[*label2++];
|
(int)maptolower[*label2++];
|
||||||
if (chdiff != 0) {
|
if (chdiff != 0) {
|
||||||
@ -667,7 +667,7 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) {
|
|||||||
REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
|
REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) ==
|
||||||
(name2->attributes & DNS_NAMEATTR_ABSOLUTE));
|
(name2->attributes & DNS_NAMEATTR_ABSOLUTE));
|
||||||
|
|
||||||
if (ISC_UNLIKELY(name1 == name2)) {
|
if (name1 == name2) {
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +683,7 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) {
|
|||||||
|
|
||||||
label1 = name1->ndata;
|
label1 = name1->ndata;
|
||||||
label2 = name2->ndata;
|
label2 = name2->ndata;
|
||||||
while (ISC_LIKELY(l-- > 0)) {
|
while (l-- > 0) {
|
||||||
count = *label1++;
|
count = *label1++;
|
||||||
if (count != *label2++) {
|
if (count != *label2++) {
|
||||||
return (false);
|
return (false);
|
||||||
@ -692,7 +692,7 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) {
|
|||||||
INSIST(count <= 63); /* no bitstring support */
|
INSIST(count <= 63); /* no bitstring support */
|
||||||
|
|
||||||
/* Loop unrolled for performance */
|
/* Loop unrolled for performance */
|
||||||
while (ISC_LIKELY(count > 3)) {
|
while (count > 3) {
|
||||||
c = maptolower[label1[0]];
|
c = maptolower[label1[0]];
|
||||||
if (c != maptolower[label2[0]]) {
|
if (c != maptolower[label2[0]]) {
|
||||||
return (false);
|
return (false);
|
||||||
@ -713,7 +713,7 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) {
|
|||||||
label1 += 4;
|
label1 += 4;
|
||||||
label2 += 4;
|
label2 += 4;
|
||||||
}
|
}
|
||||||
while (ISC_LIKELY(count-- > 0)) {
|
while (count-- > 0) {
|
||||||
c = maptolower[*label1++];
|
c = maptolower[*label1++];
|
||||||
if (c != maptolower[*label2++]) {
|
if (c != maptolower[*label2++]) {
|
||||||
return (false);
|
return (false);
|
||||||
@ -923,7 +923,7 @@ dns_name_getlabelsequence(const dns_name_t *source, unsigned int first,
|
|||||||
REQUIRE(BINDABLE(target));
|
REQUIRE(BINDABLE(target));
|
||||||
|
|
||||||
p = source->ndata;
|
p = source->ndata;
|
||||||
if (ISC_UNLIKELY(first == source->labels)) {
|
if (first == source->labels) {
|
||||||
firstoffset = source->length;
|
firstoffset = source->length;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < first; i++) {
|
for (i = 0; i < first; i++) {
|
||||||
@ -933,7 +933,7 @@ dns_name_getlabelsequence(const dns_name_t *source, unsigned int first,
|
|||||||
firstoffset = (unsigned int)(p - source->ndata);
|
firstoffset = (unsigned int)(p - source->ndata);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_LIKELY(first + n == source->labels)) {
|
if (first + n == source->labels) {
|
||||||
endoffset = source->length;
|
endoffset = source->length;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -1714,7 +1714,7 @@ set_offsets(const dns_name_t *name, unsigned char *offsets,
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
nlabels = 0;
|
nlabels = 0;
|
||||||
absolute = false;
|
absolute = false;
|
||||||
while (ISC_LIKELY(offset != length)) {
|
while (offset != length) {
|
||||||
INSIST(nlabels < 128);
|
INSIST(nlabels < 128);
|
||||||
offsets[nlabels++] = offset;
|
offsets[nlabels++] = offset;
|
||||||
count = *ndata;
|
count = *ndata;
|
||||||
@ -1722,7 +1722,7 @@ set_offsets(const dns_name_t *name, unsigned char *offsets,
|
|||||||
offset += count + 1;
|
offset += count + 1;
|
||||||
ndata += count + 1;
|
ndata += count + 1;
|
||||||
INSIST(offset <= length);
|
INSIST(offset <= length);
|
||||||
if (ISC_UNLIKELY(count == 0)) {
|
if (count == 0) {
|
||||||
absolute = true;
|
absolute = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1961,7 +1961,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
|
|||||||
(name->attributes & DNS_NAMEATTR_NOCOMPRESS) == 0 &&
|
(name->attributes & DNS_NAMEATTR_NOCOMPRESS) == 0 &&
|
||||||
(methods & DNS_COMPRESS_GLOBAL14) != 0)
|
(methods & DNS_COMPRESS_GLOBAL14) != 0)
|
||||||
{
|
{
|
||||||
if (ISC_UNLIKELY(target->length - target->used < 2)) {
|
if (target->length - target->used < 2) {
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
offset = *comp_offsetp;
|
offset = *comp_offsetp;
|
||||||
@ -2001,7 +2001,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
|
|||||||
* If the offset is too high for 14 bit global compression, we're
|
* If the offset is too high for 14 bit global compression, we're
|
||||||
* out of luck.
|
* out of luck.
|
||||||
*/
|
*/
|
||||||
if (gf && ISC_UNLIKELY(go >= 0x4000)) {
|
if (gf && go >= 0x4000) {
|
||||||
gf = false;
|
gf = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2013,7 +2013,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gf) {
|
if (gf) {
|
||||||
if (ISC_UNLIKELY(target->length - target->used < gp.length)) {
|
if (target->length - target->used < gp.length) {
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
if (gp.length != 0) {
|
if (gp.length != 0) {
|
||||||
@ -2022,7 +2022,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
|
|||||||
(size_t)gp.length);
|
(size_t)gp.length);
|
||||||
}
|
}
|
||||||
isc_buffer_add(target, gp.length);
|
isc_buffer_add(target, gp.length);
|
||||||
if (ISC_UNLIKELY(target->length - target->used < 2)) {
|
if (target->length - target->used < 2) {
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
isc_buffer_putuint16(target, go | 0xc000);
|
isc_buffer_putuint16(target, go | 0xc000);
|
||||||
@ -2035,8 +2035,7 @@ dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
|
|||||||
*comp_offsetp = go;
|
*comp_offsetp = go;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ISC_UNLIKELY(target->length - target->used < name->length))
|
if (target->length - target->used < name->length) {
|
||||||
{
|
|
||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
if (name->length != 0) {
|
if (name->length != 0) {
|
||||||
|
@ -259,8 +259,7 @@ static inline bool
|
|||||||
rehashing_in_progress(dns_rbt_t *rbt);
|
rehashing_in_progress(dns_rbt_t *rbt);
|
||||||
|
|
||||||
#define TRY_NEXTTABLE(hindex, rbt) \
|
#define TRY_NEXTTABLE(hindex, rbt) \
|
||||||
(ISC_LIKELY(hindex == rbt->hindex) && \
|
(hindex == rbt->hindex && rehashing_in_progress(rbt))
|
||||||
ISC_UNLIKELY(rehashing_in_progress(rbt)))
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
rotate_left(dns_rbtnode_t *node, dns_rbtnode_t **rootp);
|
rotate_left(dns_rbtnode_t *node, dns_rbtnode_t **rootp);
|
||||||
@ -507,7 +506,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, const dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
INSIST(add_name != NULL);
|
INSIST(add_name != NULL);
|
||||||
dns_name_clone(name, add_name);
|
dns_name_clone(name, add_name);
|
||||||
|
|
||||||
if (ISC_UNLIKELY(rbt->root == NULL)) {
|
if (rbt->root == NULL) {
|
||||||
result = create_node(rbt->mctx, add_name, &new_current);
|
result = create_node(rbt->mctx, add_name, &new_current);
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
rbt->nodecount++;
|
rbt->nodecount++;
|
||||||
@ -738,13 +737,13 @@ dns_rbt_addnode(dns_rbt_t *rbt, const dns_name_t *name, dns_rbtnode_t **nodep) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (ISC_LIKELY(child != NULL));
|
} while (child != NULL);
|
||||||
|
|
||||||
if (ISC_LIKELY(result == ISC_R_SUCCESS)) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
result = create_node(rbt->mctx, add_name, &new_current);
|
result = create_node(rbt->mctx, add_name, &new_current);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_LIKELY(result == ISC_R_SUCCESS)) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
if (*root == NULL) {
|
if (*root == NULL) {
|
||||||
UPPERNODE(new_current) = current;
|
UPPERNODE(new_current) = current;
|
||||||
} else {
|
} else {
|
||||||
@ -828,7 +827,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname,
|
|||||||
dns_rbtnodechain_reset(chain);
|
dns_rbtnodechain_reset(chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_UNLIKELY(rbt->root == NULL)) {
|
if (rbt->root == NULL) {
|
||||||
return (ISC_R_NOTFOUND);
|
return (ISC_R_NOTFOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,7 +857,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname,
|
|||||||
saved_result = ISC_R_SUCCESS;
|
saved_result = ISC_R_SUCCESS;
|
||||||
current = rbt->root;
|
current = rbt->root;
|
||||||
|
|
||||||
while (ISC_LIKELY(current != NULL)) {
|
while (current != NULL) {
|
||||||
NODENAME(current, ¤t_name);
|
NODENAME(current, ¤t_name);
|
||||||
compared = dns_name_fullcompare(search_name, ¤t_name,
|
compared = dns_name_fullcompare(search_name, ¤t_name,
|
||||||
&order, &common_labels);
|
&order, &common_labels);
|
||||||
@ -945,7 +944,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname,
|
|||||||
{
|
{
|
||||||
dns_name_t hnode_name;
|
dns_name_t hnode_name;
|
||||||
|
|
||||||
if (ISC_LIKELY(hashval != HASHVAL(hnode))) {
|
if (hashval != HASHVAL(hnode)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -954,15 +953,13 @@ dns_rbt_findnode(dns_rbt_t *rbt, const dns_name_t *name, dns_name_t *foundname,
|
|||||||
* that we don't match a labelsequence from some
|
* that we don't match a labelsequence from some
|
||||||
* other subdomain.
|
* other subdomain.
|
||||||
*/
|
*/
|
||||||
if (ISC_LIKELY(get_upper_node(hnode) !=
|
if (get_upper_node(hnode) != up_current) {
|
||||||
up_current)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_name_init(&hnode_name, NULL);
|
dns_name_init(&hnode_name, NULL);
|
||||||
NODENAME(hnode, &hnode_name);
|
NODENAME(hnode, &hnode_name);
|
||||||
if (ISC_LIKELY(dns_name_equal(&hnode_name,
|
if (dns_name_equal(&hnode_name, &hash_name)) {
|
||||||
&hash_name))) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1760,10 +1757,10 @@ static inline void
|
|||||||
hash_node(dns_rbt_t *rbt, dns_rbtnode_t *node, const dns_name_t *name) {
|
hash_node(dns_rbt_t *rbt, dns_rbtnode_t *node, const dns_name_t *name) {
|
||||||
REQUIRE(DNS_RBTNODE_VALID(node));
|
REQUIRE(DNS_RBTNODE_VALID(node));
|
||||||
|
|
||||||
if (ISC_UNLIKELY(rehashing_in_progress(rbt))) {
|
if (rehashing_in_progress(rbt)) {
|
||||||
/* Rehash in progress */
|
/* Rehash in progress */
|
||||||
hashtable_rehash_one(rbt);
|
hashtable_rehash_one(rbt);
|
||||||
} else if (ISC_UNLIKELY(hashtable_is_overcommited(rbt))) {
|
} else if (hashtable_is_overcommited(rbt)) {
|
||||||
/* Rehash requested */
|
/* Rehash requested */
|
||||||
maybe_rehash(rbt, rbt->nodecount);
|
maybe_rehash(rbt, rbt->nodecount);
|
||||||
}
|
}
|
||||||
|
@ -9360,7 +9360,7 @@ setownercase(rdatasetheader_t *header, const dns_name_t *name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RDATASET_ATTR_SET(header, RDATASET_ATTR_CASESET);
|
RDATASET_ATTR_SET(header, RDATASET_ATTR_CASESET);
|
||||||
if (ISC_LIKELY(fully_lower)) {
|
if (fully_lower) {
|
||||||
RDATASET_ATTR_SET(header, RDATASET_ATTR_CASEFULLYLOWER);
|
RDATASET_ATTR_SET(header, RDATASET_ATTR_CASEFULLYLOWER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9399,7 +9399,7 @@ rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name) {
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_LIKELY(CASEFULLYLOWER(header))) {
|
if (CASEFULLYLOWER(header)) {
|
||||||
for (size_t i = 0; i < name->length; i++) {
|
for (size_t i = 0; i < name->length; i++) {
|
||||||
name->ndata[i] = tolower(name->ndata[i]);
|
name->ndata[i] = tolower(name->ndata[i]);
|
||||||
}
|
}
|
||||||
@ -9568,7 +9568,7 @@ static void
|
|||||||
maybe_rehash_gluetable(rbtdb_version_t *version) {
|
maybe_rehash_gluetable(rbtdb_version_t *version) {
|
||||||
size_t overcommit = HASHSIZE(version->glue_table_bits) *
|
size_t overcommit = HASHSIZE(version->glue_table_bits) *
|
||||||
RBTDB_GLUE_TABLE_OVERCOMMIT;
|
RBTDB_GLUE_TABLE_OVERCOMMIT;
|
||||||
if (ISC_LIKELY(version->glue_table_nodecount < overcommit)) {
|
if (version->glue_table_nodecount < overcommit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9775,7 +9775,7 @@ restart:
|
|||||||
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
|
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
|
||||||
|
|
||||||
result = dns_message_gettempname(msg, &name);
|
result = dns_message_gettempname(msg, &name);
|
||||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
goto no_glue;
|
goto no_glue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9783,7 +9783,7 @@ restart:
|
|||||||
|
|
||||||
if (dns_rdataset_isassociated(&ge->rdataset_a)) {
|
if (dns_rdataset_isassociated(&ge->rdataset_a)) {
|
||||||
result = dns_message_gettemprdataset(msg, &rdataset_a);
|
result = dns_message_gettemprdataset(msg, &rdataset_a);
|
||||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_message_puttempname(msg, &name);
|
dns_message_puttempname(msg, &name);
|
||||||
goto no_glue;
|
goto no_glue;
|
||||||
}
|
}
|
||||||
@ -9792,7 +9792,7 @@ restart:
|
|||||||
if (dns_rdataset_isassociated(&ge->sigrdataset_a)) {
|
if (dns_rdataset_isassociated(&ge->sigrdataset_a)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
result = dns_message_gettemprdataset(msg,
|
||||||
&sigrdataset_a);
|
&sigrdataset_a);
|
||||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
if (rdataset_a != NULL) {
|
if (rdataset_a != NULL) {
|
||||||
dns_message_puttemprdataset(
|
dns_message_puttemprdataset(
|
||||||
msg, &rdataset_a);
|
msg, &rdataset_a);
|
||||||
@ -9805,7 +9805,7 @@ restart:
|
|||||||
if (dns_rdataset_isassociated(&ge->rdataset_aaaa)) {
|
if (dns_rdataset_isassociated(&ge->rdataset_aaaa)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
result = dns_message_gettemprdataset(msg,
|
||||||
&rdataset_aaaa);
|
&rdataset_aaaa);
|
||||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_message_puttempname(msg, &name);
|
dns_message_puttempname(msg, &name);
|
||||||
if (rdataset_a != NULL) {
|
if (rdataset_a != NULL) {
|
||||||
dns_message_puttemprdataset(
|
dns_message_puttemprdataset(
|
||||||
@ -9822,7 +9822,7 @@ restart:
|
|||||||
if (dns_rdataset_isassociated(&ge->sigrdataset_aaaa)) {
|
if (dns_rdataset_isassociated(&ge->sigrdataset_aaaa)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
result = dns_message_gettemprdataset(msg,
|
||||||
&sigrdataset_aaaa);
|
&sigrdataset_aaaa);
|
||||||
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_message_puttempname(msg, &name);
|
dns_message_puttempname(msg, &name);
|
||||||
if (rdataset_a != NULL) {
|
if (rdataset_a != NULL) {
|
||||||
dns_message_puttemprdataset(
|
dns_message_puttemprdataset(
|
||||||
@ -9840,7 +9840,7 @@ restart:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_LIKELY(rdataset_a != NULL)) {
|
if (rdataset_a != NULL) {
|
||||||
dns_rdataset_clone(&ge->rdataset_a, rdataset_a);
|
dns_rdataset_clone(&ge->rdataset_a, rdataset_a);
|
||||||
ISC_LIST_APPEND(name->list, rdataset_a, link);
|
ISC_LIST_APPEND(name->list, rdataset_a, link);
|
||||||
}
|
}
|
||||||
|
@ -406,18 +406,17 @@ towiresorted(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
|
|||||||
}
|
}
|
||||||
INSIST(i == count);
|
INSIST(i == count);
|
||||||
|
|
||||||
if (ISC_LIKELY(want_random)) {
|
if (want_random) {
|
||||||
seed = isc_random32();
|
seed = isc_random32();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_UNLIKELY(want_cyclic) &&
|
if (want_cyclic &&
|
||||||
(rdataset->count != DNS_RDATASET_COUNT_UNDEFINED))
|
(rdataset->count != DNS_RDATASET_COUNT_UNDEFINED)) {
|
||||||
{
|
|
||||||
j = rdataset->count % count;
|
j = rdataset->count % count;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (ISC_LIKELY(want_random)) {
|
if (want_random) {
|
||||||
swap_rdata(in, j, j + seed % (count - j));
|
swap_rdata(in, j, j + seed % (count - j));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4963,7 +4963,7 @@ same_question(fetchctx_t *fctx, dns_message_t *message) {
|
|||||||
/*
|
/*
|
||||||
* XXXRTH Currently we support only one question.
|
* XXXRTH Currently we support only one question.
|
||||||
*/
|
*/
|
||||||
if (ISC_UNLIKELY(message->counts[DNS_SECTION_QUESTION] == 0)) {
|
if (message->counts[DNS_SECTION_QUESTION] == 0) {
|
||||||
if ((message->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
if ((message->flags & DNS_MESSAGEFLAG_TC) != 0) {
|
||||||
/*
|
/*
|
||||||
* If TC=1 and the question section is empty, we
|
* If TC=1 and the question section is empty, we
|
||||||
@ -4987,7 +4987,7 @@ same_question(fetchctx_t *fctx, dns_message_t *message) {
|
|||||||
log_formerr(fctx, "empty question section");
|
log_formerr(fctx, "empty question section");
|
||||||
return (DNS_R_FORMERR);
|
return (DNS_R_FORMERR);
|
||||||
}
|
}
|
||||||
} else if (ISC_UNLIKELY(message->counts[DNS_SECTION_QUESTION] > 1)) {
|
} else if (message->counts[DNS_SECTION_QUESTION] > 1) {
|
||||||
log_formerr(fctx, "too many questions");
|
log_formerr(fctx, "too many questions");
|
||||||
return (DNS_R_FORMERR);
|
return (DNS_R_FORMERR);
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1087,7 @@ diff_keys(const dns_rpz_cidr_key_t *key1, dns_rpz_prefix_t prefix1,
|
|||||||
*/
|
*/
|
||||||
for (i = 0; bit < maxbit; i++, bit += DNS_RPZ_CIDR_WORD_BITS) {
|
for (i = 0; bit < maxbit; i++, bit += DNS_RPZ_CIDR_WORD_BITS) {
|
||||||
delta = key1->w[i] ^ key2->w[i];
|
delta = key1->w[i] ^ key2->w[i];
|
||||||
if (ISC_UNLIKELY(delta != 0)) {
|
if (delta != 0) {
|
||||||
#ifdef HAVE_BUILTIN_CLZ
|
#ifdef HAVE_BUILTIN_CLZ
|
||||||
bit += __builtin_clz(delta);
|
bit += __builtin_clz(delta);
|
||||||
#else /* ifdef HAVE_BUILTIN_CLZ */
|
#else /* ifdef HAVE_BUILTIN_CLZ */
|
||||||
|
@ -45,7 +45,6 @@ libisc_la_HEADERS = \
|
|||||||
include/isc/iterated_hash.h \
|
include/isc/iterated_hash.h \
|
||||||
include/isc/lang.h \
|
include/isc/lang.h \
|
||||||
include/isc/lex.h \
|
include/isc/lex.h \
|
||||||
include/isc/likely.h \
|
|
||||||
include/isc/list.h \
|
include/isc/list.h \
|
||||||
include/isc/log.h \
|
include/isc/log.h \
|
||||||
include/isc/magic.h \
|
include/isc/magic.h \
|
||||||
|
@ -292,7 +292,7 @@ void
|
|||||||
isc__buffer_putuint8(isc_buffer_t *b, uint8_t val) {
|
isc__buffer_putuint8(isc_buffer_t *b, uint8_t val) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, 1);
|
result = isc_buffer_reserve(&b, 1);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ void
|
|||||||
isc__buffer_putuint16(isc_buffer_t *b, uint16_t val) {
|
isc__buffer_putuint16(isc_buffer_t *b, uint16_t val) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, 2);
|
result = isc_buffer_reserve(&b, 2);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ void
|
|||||||
isc__buffer_putuint24(isc_buffer_t *b, uint32_t val) {
|
isc__buffer_putuint24(isc_buffer_t *b, uint32_t val) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, 3);
|
result = isc_buffer_reserve(&b, 3);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ void
|
|||||||
isc__buffer_putuint32(isc_buffer_t *b, uint32_t val) {
|
isc__buffer_putuint32(isc_buffer_t *b, uint32_t val) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, 4);
|
result = isc_buffer_reserve(&b, 4);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ isc__buffer_putuint48(isc_buffer_t *b, uint64_t val) {
|
|||||||
uint32_t vallo;
|
uint32_t vallo;
|
||||||
|
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, 6);
|
result = isc_buffer_reserve(&b, 6);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
|
|||||||
unsigned int length) {
|
unsigned int length) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, length);
|
result = isc_buffer_reserve(&b, length);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
|
|||||||
* Do not use ISC__BUFFER_PUTSTR(), so strlen is only done once.
|
* Do not use ISC__BUFFER_PUTSTR(), so strlen is only done once.
|
||||||
*/
|
*/
|
||||||
l = strlen(source);
|
l = strlen(source);
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, l);
|
result = isc_buffer_reserve(&b, l);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ isc_buffer_putdecint(isc_buffer_t *b, int64_t v) {
|
|||||||
/* xxxwpk do it more low-level way ? */
|
/* xxxwpk do it more low-level way ? */
|
||||||
l = snprintf(buf, 21, "%" PRId64, v);
|
l = snprintf(buf, 21, "%" PRId64, v);
|
||||||
RUNTIME_CHECK(l <= 21);
|
RUNTIME_CHECK(l <= 21);
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, l);
|
result = isc_buffer_reserve(&b, l);
|
||||||
REQUIRE(result == ISC_R_SUCCESS);
|
REQUIRE(result == ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -515,7 +515,7 @@ isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) {
|
|||||||
REQUIRE(ISC_BUFFER_VALID(b));
|
REQUIRE(ISC_BUFFER_VALID(b));
|
||||||
REQUIRE(r != NULL);
|
REQUIRE(r != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, r->length);
|
result = isc_buffer_reserve(&b, r->length);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
return (result);
|
return (result);
|
||||||
@ -623,7 +623,7 @@ isc_buffer_printf(isc_buffer_t *b, const char *format, ...) {
|
|||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ISC_UNLIKELY(b->autore)) {
|
if (b->autore) {
|
||||||
result = isc_buffer_reserve(&b, n + 1);
|
result = isc_buffer_reserve(&b, n + 1);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
return (result);
|
return (result);
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "entropy_private.h"
|
#include "entropy_private.h"
|
||||||
#include "isc/hash.h" /* IWYU pragma: keep */
|
#include "isc/hash.h" /* IWYU pragma: keep */
|
||||||
#include "isc/likely.h"
|
|
||||||
#include "isc/once.h"
|
#include "isc/once.h"
|
||||||
#include "isc/random.h"
|
#include "isc/random.h"
|
||||||
#include "isc/result.h"
|
#include "isc/result.h"
|
||||||
@ -74,7 +73,7 @@ static uint8_t maptolower[] = {
|
|||||||
|
|
||||||
const void *
|
const void *
|
||||||
isc_hash_get_initializer(void) {
|
isc_hash_get_initializer(void) {
|
||||||
if (ISC_UNLIKELY(!hash_initialized)) {
|
if (!hash_initialized) {
|
||||||
RUNTIME_CHECK(
|
RUNTIME_CHECK(
|
||||||
isc_once_do(&isc_hash_once, isc_hash_initialize) ==
|
isc_once_do(&isc_hash_once, isc_hash_initialize) ==
|
||||||
ISC_R_SUCCESS);
|
ISC_R_SUCCESS);
|
||||||
@ -91,7 +90,7 @@ isc_hash_set_initializer(const void *initializer) {
|
|||||||
* Ensure that isc_hash_initialize() is not called after
|
* Ensure that isc_hash_initialize() is not called after
|
||||||
* isc_hash_set_initializer() is called.
|
* isc_hash_set_initializer() is called.
|
||||||
*/
|
*/
|
||||||
if (ISC_UNLIKELY(!hash_initialized)) {
|
if (!hash_initialized) {
|
||||||
RUNTIME_CHECK(
|
RUNTIME_CHECK(
|
||||||
isc_once_do(&isc_hash_once, isc_hash_initialize) ==
|
isc_once_do(&isc_hash_once, isc_hash_initialize) ==
|
||||||
ISC_R_SUCCESS);
|
ISC_R_SUCCESS);
|
||||||
|
@ -31,7 +31,7 @@ isc_hmac_new(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
isc_hmac_free(isc_hmac_t *hmac) {
|
isc_hmac_free(isc_hmac_t *hmac) {
|
||||||
if (ISC_UNLIKELY(hmac == NULL)) {
|
if (hmac == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ isc_result_t
|
|||||||
isc_hmac_update(isc_hmac_t *hmac, const unsigned char *buf, const size_t len) {
|
isc_hmac_update(isc_hmac_t *hmac, const unsigned char *buf, const size_t len) {
|
||||||
REQUIRE(hmac != NULL);
|
REQUIRE(hmac != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY(buf == NULL || len == 0)) {
|
if (buf == NULL || len == 0) {
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <isc/attributes.h>
|
#include <isc/attributes.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/likely.h>
|
|
||||||
|
|
||||||
ISC_LANG_BEGINDECLS
|
ISC_LANG_BEGINDECLS
|
||||||
|
|
||||||
@ -42,25 +41,25 @@ const char *
|
|||||||
isc_assertion_typetotext(isc_assertiontype_t type);
|
isc_assertion_typetotext(isc_assertiontype_t type);
|
||||||
|
|
||||||
#define ISC_REQUIRE(cond) \
|
#define ISC_REQUIRE(cond) \
|
||||||
((void)(ISC_LIKELY(cond) || \
|
((void)((cond) || \
|
||||||
((isc_assertion_failed)(__FILE__, __LINE__, \
|
((isc_assertion_failed)(__FILE__, __LINE__, \
|
||||||
isc_assertiontype_require, #cond), \
|
isc_assertiontype_require, #cond), \
|
||||||
0)))
|
0)))
|
||||||
|
|
||||||
#define ISC_ENSURE(cond) \
|
#define ISC_ENSURE(cond) \
|
||||||
((void)(ISC_LIKELY(cond) || \
|
((void)((cond) || \
|
||||||
((isc_assertion_failed)(__FILE__, __LINE__, \
|
((isc_assertion_failed)(__FILE__, __LINE__, \
|
||||||
isc_assertiontype_ensure, #cond), \
|
isc_assertiontype_ensure, #cond), \
|
||||||
0)))
|
0)))
|
||||||
|
|
||||||
#define ISC_INSIST(cond) \
|
#define ISC_INSIST(cond) \
|
||||||
((void)(ISC_LIKELY(cond) || \
|
((void)((cond) || \
|
||||||
((isc_assertion_failed)(__FILE__, __LINE__, \
|
((isc_assertion_failed)(__FILE__, __LINE__, \
|
||||||
isc_assertiontype_insist, #cond), \
|
isc_assertiontype_insist, #cond), \
|
||||||
0)))
|
0)))
|
||||||
|
|
||||||
#define ISC_INVARIANT(cond) \
|
#define ISC_INVARIANT(cond) \
|
||||||
((void)(ISC_LIKELY(cond) || \
|
((void)((cond) || \
|
||||||
((isc_assertion_failed)(__FILE__, __LINE__, \
|
((isc_assertion_failed)(__FILE__, __LINE__, \
|
||||||
isc_assertiontype_invariant, #cond), \
|
isc_assertiontype_invariant, #cond), \
|
||||||
0)))
|
0)))
|
||||||
|
@ -104,7 +104,6 @@
|
|||||||
#include <isc/assertions.h>
|
#include <isc/assertions.h>
|
||||||
#include <isc/formatcheck.h>
|
#include <isc/formatcheck.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/likely.h>
|
|
||||||
#include <isc/magic.h>
|
#include <isc/magic.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
|
||||||
@ -899,7 +898,7 @@ ISC_LANG_ENDDECLS
|
|||||||
|
|
||||||
#define ISC__BUFFER_PUTMEM(_b, _base, _length) \
|
#define ISC__BUFFER_PUTMEM(_b, _base, _length) \
|
||||||
do { \
|
do { \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
@ -917,7 +916,7 @@ ISC_LANG_ENDDECLS
|
|||||||
unsigned int _length; \
|
unsigned int _length; \
|
||||||
unsigned char *_cp; \
|
unsigned char *_cp; \
|
||||||
_length = (unsigned int)strlen(_source); \
|
_length = (unsigned int)strlen(_source); \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, _length) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
@ -933,7 +932,7 @@ ISC_LANG_ENDDECLS
|
|||||||
unsigned char *_cp; \
|
unsigned char *_cp; \
|
||||||
/* evaluate (_val) only once */ \
|
/* evaluate (_val) only once */ \
|
||||||
uint8_t _val2 = (_val); \
|
uint8_t _val2 = (_val); \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 1) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 1) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
@ -949,7 +948,7 @@ ISC_LANG_ENDDECLS
|
|||||||
unsigned char *_cp; \
|
unsigned char *_cp; \
|
||||||
/* evaluate (_val) only once */ \
|
/* evaluate (_val) only once */ \
|
||||||
uint16_t _val2 = (_val); \
|
uint16_t _val2 = (_val); \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 2) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 2) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
@ -966,7 +965,7 @@ ISC_LANG_ENDDECLS
|
|||||||
unsigned char *_cp; \
|
unsigned char *_cp; \
|
||||||
/* evaluate (_val) only once */ \
|
/* evaluate (_val) only once */ \
|
||||||
uint32_t _val2 = (_val); \
|
uint32_t _val2 = (_val); \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 3) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 3) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
@ -984,7 +983,7 @@ ISC_LANG_ENDDECLS
|
|||||||
unsigned char *_cp; \
|
unsigned char *_cp; \
|
||||||
/* evaluate (_val) only once */ \
|
/* evaluate (_val) only once */ \
|
||||||
uint32_t _val2 = (_val); \
|
uint32_t _val2 = (_val); \
|
||||||
if (ISC_UNLIKELY((_b)->autore)) { \
|
if ((_b)->autore) { \
|
||||||
isc_buffer_t *_tmp = _b; \
|
isc_buffer_t *_tmp = _b; \
|
||||||
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 4) == \
|
ISC_REQUIRE(isc_buffer_reserve(&_tmp, 4) == \
|
||||||
ISC_R_SUCCESS); \
|
ISC_R_SUCCESS); \
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <isc/attributes.h>
|
#include <isc/attributes.h>
|
||||||
#include <isc/formatcheck.h>
|
#include <isc/formatcheck.h>
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/likely.h>
|
|
||||||
|
|
||||||
ISC_LANG_BEGINDECLS
|
ISC_LANG_BEGINDECLS
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ ISC_NORETURN void
|
|||||||
isc_error_runtimecheck(const char *, int, const char *);
|
isc_error_runtimecheck(const char *, int, const char *);
|
||||||
|
|
||||||
#define ISC_ERROR_RUNTIMECHECK(cond) \
|
#define ISC_ERROR_RUNTIMECHECK(cond) \
|
||||||
((void)(ISC_LIKELY(cond) || \
|
((void)((cond) || \
|
||||||
((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0)))
|
((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0)))
|
||||||
|
|
||||||
ISC_LANG_ENDDECLS
|
ISC_LANG_ENDDECLS
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* See the COPYRIGHT file distributed with this work for additional
|
|
||||||
* information regarding copyright ownership.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/*%
|
|
||||||
* Performance
|
|
||||||
*/
|
|
||||||
#ifdef CPPCHECK
|
|
||||||
#define ISC_LIKELY(x) (x)
|
|
||||||
#define ISC_UNLIKELY(x) (x)
|
|
||||||
#else /* ifdef CPPCHECK */
|
|
||||||
#ifdef HAVE_BUILTIN_EXPECT
|
|
||||||
#define ISC_LIKELY(x) __builtin_expect(!!(x), 1)
|
|
||||||
#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
|
||||||
#else /* ifdef HAVE_BUILTIN_EXPECT */
|
|
||||||
#define ISC_LIKELY(x) (x)
|
|
||||||
#define ISC_UNLIKELY(x) (x)
|
|
||||||
#endif /* ifdef HAVE_BUILTIN_EXPECT */
|
|
||||||
#endif /* ifdef CPPCHECK */
|
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <isc/likely.h>
|
|
||||||
|
|
||||||
/*! \file isc/magic.h */
|
/*! \file isc/magic.h */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -26,7 +24,6 @@ typedef struct {
|
|||||||
* the object is otherwise opaque.
|
* the object is otherwise opaque.
|
||||||
*/
|
*/
|
||||||
#define ISC_MAGIC_VALID(a, b) \
|
#define ISC_MAGIC_VALID(a, b) \
|
||||||
(ISC_LIKELY((a) != NULL) && \
|
((a) != NULL && ((const isc__magic_t *)(a))->magic == (b))
|
||||||
ISC_LIKELY(((const isc__magic_t *)(a))->magic == (b)))
|
|
||||||
|
|
||||||
#define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
|
#define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
|
||||||
|
@ -195,7 +195,6 @@
|
|||||||
/*%
|
/*%
|
||||||
* Performance
|
* Performance
|
||||||
*/
|
*/
|
||||||
#include <isc/likely.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_BUILTIN_UNREACHABLE
|
#ifdef HAVE_BUILTIN_UNREACHABLE
|
||||||
#define ISC_UNREACHABLE() __builtin_unreachable();
|
#define ISC_UNREACHABLE() __builtin_unreachable();
|
||||||
|
@ -29,7 +29,7 @@ isc_md_new(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
isc_md_free(isc_md_t *md) {
|
isc_md_free(isc_md_t *md) {
|
||||||
if (ISC_UNLIKELY(md == NULL)) {
|
if (md == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ isc_result_t
|
|||||||
isc_md_update(isc_md_t *md, const unsigned char *buf, const size_t len) {
|
isc_md_update(isc_md_t *md, const unsigned char *buf, const size_t len) {
|
||||||
REQUIRE(md != NULL);
|
REQUIRE(md != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY(buf == NULL || len == 0)) {
|
if (buf == NULL || len == 0) {
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +188,7 @@ struct isc_mempool {
|
|||||||
#define TRACE_OR_RECORD (ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD)
|
#define TRACE_OR_RECORD (ISC_MEM_DEBUGTRACE | ISC_MEM_DEBUGRECORD)
|
||||||
|
|
||||||
#define SHOULD_TRACE_OR_RECORD(ptr) \
|
#define SHOULD_TRACE_OR_RECORD(ptr) \
|
||||||
(ISC_UNLIKELY((isc_mem_debugging & TRACE_OR_RECORD) != 0) && \
|
((isc_mem_debugging & TRACE_OR_RECORD) != 0 && ptr != NULL)
|
||||||
ptr != NULL)
|
|
||||||
|
|
||||||
#define ADD_TRACE(a, b, c, d, e) \
|
#define ADD_TRACE(a, b, c, d, e) \
|
||||||
if (SHOULD_TRACE_OR_RECORD(b)) { \
|
if (SHOULD_TRACE_OR_RECORD(b)) { \
|
||||||
@ -303,8 +302,8 @@ delete_trace_entry(isc_mem_t *mctx, const void *ptr, size_t size,
|
|||||||
idx = hash % DEBUG_TABLE_COUNT;
|
idx = hash % DEBUG_TABLE_COUNT;
|
||||||
|
|
||||||
dl = ISC_LIST_HEAD(mctx->debuglist[idx]);
|
dl = ISC_LIST_HEAD(mctx->debuglist[idx]);
|
||||||
while (ISC_LIKELY(dl != NULL)) {
|
while (dl != NULL) {
|
||||||
if (ISC_UNLIKELY(dl->ptr == ptr)) {
|
if (dl->ptr == ptr) {
|
||||||
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
ISC_LIST_UNLINK(mctx->debuglist[idx], dl, link);
|
||||||
decrement_malloced(mctx, sizeof(*dl));
|
decrement_malloced(mctx, sizeof(*dl));
|
||||||
sdallocx(dl, sizeof(*dl), 0);
|
sdallocx(dl, sizeof(*dl), 0);
|
||||||
@ -325,7 +324,7 @@ unlock:
|
|||||||
#endif /* ISC_MEM_TRACKLINES */
|
#endif /* ISC_MEM_TRACKLINES */
|
||||||
|
|
||||||
#define ADJUST_ZERO_ALLOCATION_SIZE(s) \
|
#define ADJUST_ZERO_ALLOCATION_SIZE(s) \
|
||||||
if (ISC_UNLIKELY(s == 0)) { \
|
if (s == 0) { \
|
||||||
s = ZERO_ALLOCATION_SIZE; \
|
s = ZERO_ALLOCATION_SIZE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +340,7 @@ mem_get(isc_mem_t *ctx, size_t size) {
|
|||||||
ret = mallocx(size, 0);
|
ret = mallocx(size, 0);
|
||||||
INSIST(ret != NULL);
|
INSIST(ret != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
|
if ((ctx->flags & ISC_MEMFLAG_FILL) != 0) {
|
||||||
memset(ret, 0xbe, size); /* Mnemonic for "beef". */
|
memset(ret, 0xbe, size); /* Mnemonic for "beef". */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,7 +355,7 @@ static inline void
|
|||||||
mem_put(isc_mem_t *ctx, void *mem, size_t size) {
|
mem_put(isc_mem_t *ctx, void *mem, size_t size) {
|
||||||
ADJUST_ZERO_ALLOCATION_SIZE(size);
|
ADJUST_ZERO_ALLOCATION_SIZE(size);
|
||||||
|
|
||||||
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
|
if ((ctx->flags & ISC_MEMFLAG_FILL) != 0) {
|
||||||
memset(mem, 0xde, size); /* Mnemonic for "dead". */
|
memset(mem, 0xde, size); /* Mnemonic for "dead". */
|
||||||
}
|
}
|
||||||
sdallocx(mem, size, 0);
|
sdallocx(mem, size, 0);
|
||||||
@ -371,7 +370,7 @@ mem_realloc(isc_mem_t *ctx, void *old_ptr, size_t old_size, size_t new_size) {
|
|||||||
new_ptr = rallocx(old_ptr, new_size, 0);
|
new_ptr = rallocx(old_ptr, new_size, 0);
|
||||||
INSIST(new_ptr != NULL);
|
INSIST(new_ptr != NULL);
|
||||||
|
|
||||||
if (ISC_UNLIKELY((ctx->flags & ISC_MEMFLAG_FILL) != 0)) {
|
if ((ctx->flags & ISC_MEMFLAG_FILL) != 0) {
|
||||||
ssize_t diff_size = new_size - old_size;
|
ssize_t diff_size = new_size - old_size;
|
||||||
void *diff_ptr = (uint8_t *)new_ptr + old_size;
|
void *diff_ptr = (uint8_t *)new_ptr + old_size;
|
||||||
if (diff_size > 0) {
|
if (diff_size > 0) {
|
||||||
@ -483,7 +482,7 @@ mem_create(isc_mem_t **ctxp, unsigned int flags) {
|
|||||||
ISC_LIST_INIT(ctx->pools);
|
ISC_LIST_INIT(ctx->pools);
|
||||||
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0)) {
|
if ((isc_mem_debugging & ISC_MEM_DEBUGRECORD) != 0) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
ctx->debuglist =
|
ctx->debuglist =
|
||||||
@ -524,7 +523,7 @@ destroy(isc_mem_t *ctx) {
|
|||||||
INSIST(ISC_LIST_EMPTY(ctx->pools));
|
INSIST(ISC_LIST_EMPTY(ctx->pools));
|
||||||
|
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
if (ISC_UNLIKELY(ctx->debuglist != NULL)) {
|
if (ctx->debuglist != NULL) {
|
||||||
debuglink_t *dl;
|
debuglink_t *dl;
|
||||||
for (i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
for (i = 0; i < DEBUG_TABLE_COUNT; i++) {
|
||||||
for (dl = ISC_LIST_HEAD(ctx->debuglist[i]); dl != NULL;
|
for (dl = ISC_LIST_HEAD(ctx->debuglist[i]); dl != NULL;
|
||||||
@ -903,10 +902,10 @@ isc__mem_reget(isc_mem_t *ctx, void *old_ptr, size_t old_size,
|
|||||||
size_t new_size FLARG) {
|
size_t new_size FLARG) {
|
||||||
void *new_ptr = NULL;
|
void *new_ptr = NULL;
|
||||||
|
|
||||||
if (ISC_UNLIKELY(old_ptr == NULL)) {
|
if (old_ptr == NULL) {
|
||||||
REQUIRE(old_size == 0);
|
REQUIRE(old_size == 0);
|
||||||
new_ptr = isc__mem_get(ctx, new_size FLARG_PASS);
|
new_ptr = isc__mem_get(ctx, new_size FLARG_PASS);
|
||||||
} else if (ISC_UNLIKELY(new_size == 0)) {
|
} else if (new_size == 0) {
|
||||||
isc__mem_put(ctx, old_ptr, old_size FLARG_PASS);
|
isc__mem_put(ctx, old_ptr, old_size FLARG_PASS);
|
||||||
} else {
|
} else {
|
||||||
DELETE_TRACE(ctx, old_ptr, old_size, file, line);
|
DELETE_TRACE(ctx, old_ptr, old_size, file, line);
|
||||||
@ -935,9 +934,9 @@ isc__mem_reallocate(isc_mem_t *ctx, void *old_ptr, size_t new_size FLARG) {
|
|||||||
|
|
||||||
REQUIRE(VALID_CONTEXT(ctx));
|
REQUIRE(VALID_CONTEXT(ctx));
|
||||||
|
|
||||||
if (ISC_UNLIKELY(old_ptr == NULL)) {
|
if (old_ptr == NULL) {
|
||||||
new_ptr = isc__mem_allocate(ctx, new_size FLARG_PASS);
|
new_ptr = isc__mem_allocate(ctx, new_size FLARG_PASS);
|
||||||
} else if (ISC_UNLIKELY(new_size == 0)) {
|
} else if (new_size == 0) {
|
||||||
isc__mem_free(ctx, old_ptr FLARG_PASS);
|
isc__mem_free(ctx, old_ptr FLARG_PASS);
|
||||||
} else {
|
} else {
|
||||||
size_t old_size = sallocx(old_ptr, 0);
|
size_t old_size = sallocx(old_ptr, 0);
|
||||||
@ -1289,7 +1288,7 @@ isc__mempool_get(isc_mempool_t *restrict mpctx FLARG) {
|
|||||||
|
|
||||||
mpctx->allocated++;
|
mpctx->allocated++;
|
||||||
|
|
||||||
if (ISC_UNLIKELY(mpctx->items == NULL)) {
|
if (mpctx->items == NULL) {
|
||||||
isc_mem_t *mctx = mpctx->mctx;
|
isc_mem_t *mctx = mpctx->mctx;
|
||||||
const size_t fillcount = mpctx->fillcount;
|
const size_t fillcount = mpctx->fillcount;
|
||||||
/*
|
/*
|
||||||
@ -1442,7 +1441,7 @@ isc__mem_checkdestroyed(void) {
|
|||||||
LOCK(&contextslock);
|
LOCK(&contextslock);
|
||||||
if (!ISC_LIST_EMPTY(contexts)) {
|
if (!ISC_LIST_EMPTY(contexts)) {
|
||||||
#if ISC_MEM_TRACKLINES
|
#if ISC_MEM_TRACKLINES
|
||||||
if (ISC_UNLIKELY((isc_mem_debugging & TRACE_OR_RECORD) != 0)) {
|
if ((isc_mem_debugging & TRACE_OR_RECORD) != 0) {
|
||||||
print_contexts(file);
|
print_contexts(file);
|
||||||
}
|
}
|
||||||
#endif /* if ISC_MEM_TRACKLINES */
|
#endif /* if ISC_MEM_TRACKLINES */
|
||||||
|
@ -126,7 +126,7 @@ tls_senddone(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
|
|||||||
/* We are tying to avoid a memory allocation for small write
|
/* We are tying to avoid a memory allocation for small write
|
||||||
* requests. See the mirroring code in the tls_send_outgoing()
|
* requests. See the mirroring code in the tls_send_outgoing()
|
||||||
* function. */
|
* function. */
|
||||||
if (ISC_UNLIKELY(send_req->data.length > sizeof(send_req->smallbuf))) {
|
if (send_req->data.length > sizeof(send_req->smallbuf)) {
|
||||||
isc_mem_put(handle->sock->mgr->mctx, send_req->data.base,
|
isc_mem_put(handle->sock->mgr->mctx, send_req->data.base,
|
||||||
send_req->data.length);
|
send_req->data.length);
|
||||||
} else {
|
} else {
|
||||||
@ -247,7 +247,7 @@ tls_send_outgoing(isc_nmsocket_t *sock, bool finish, isc_nmhandle_t *tlshandle,
|
|||||||
.data.length = pending };
|
.data.length = pending };
|
||||||
|
|
||||||
/* Let's try to avoid a memory allocation for small write requests */
|
/* Let's try to avoid a memory allocation for small write requests */
|
||||||
if (ISC_UNLIKELY((size_t)pending > sizeof(send_req->smallbuf))) {
|
if ((size_t)pending > sizeof(send_req->smallbuf)) {
|
||||||
send_req->data.base = isc_mem_get(sock->mgr->mctx, pending);
|
send_req->data.base = isc_mem_get(sock->mgr->mctx, pending);
|
||||||
} else {
|
} else {
|
||||||
send_req->data.base = &send_req->smallbuf[0];
|
send_req->data.base = &send_req->smallbuf[0];
|
||||||
|
@ -1369,9 +1369,8 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||||||
* If # zone labels < # name labels, try to find an even better match
|
* If # zone labels < # name labels, try to find an even better match
|
||||||
* Only try if DLZ drivers are loaded for this view
|
* Only try if DLZ drivers are loaded for this view
|
||||||
*/
|
*/
|
||||||
if (ISC_UNLIKELY(zonelabels < namelabels &&
|
if (zonelabels < namelabels &&
|
||||||
!ISC_LIST_EMPTY(client->view->dlz_searched)))
|
!ISC_LIST_EMPTY(client->view->dlz_searched)) {
|
||||||
{
|
|
||||||
dns_clientinfomethods_t cm;
|
dns_clientinfomethods_t cm;
|
||||||
dns_clientinfo_t ci;
|
dns_clientinfo_t ci;
|
||||||
dns_db_t *tdbp;
|
dns_db_t *tdbp;
|
||||||
@ -5497,10 +5496,9 @@ ns__query_start(query_ctx_t *qctx) {
|
|||||||
result = query_getdb(qctx->client, qctx->client->query.qname,
|
result = query_getdb(qctx->client, qctx->client->query.qname,
|
||||||
qctx->qtype, qctx->options, &qctx->zone, &qctx->db,
|
qctx->qtype, qctx->options, &qctx->zone, &qctx->db,
|
||||||
&qctx->version, &qctx->is_zone);
|
&qctx->version, &qctx->is_zone);
|
||||||
if (ISC_UNLIKELY((result != ISC_R_SUCCESS || !qctx->is_zone) &&
|
if ((result != ISC_R_SUCCESS || !qctx->is_zone) &&
|
||||||
qctx->qtype == dns_rdatatype_ds &&
|
qctx->qtype == dns_rdatatype_ds && !RECURSIONOK(qctx->client) &&
|
||||||
!RECURSIONOK(qctx->client) &&
|
(qctx->options & DNS_GETDB_NOEXACT) != 0)
|
||||||
(qctx->options & DNS_GETDB_NOEXACT) != 0))
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is a non-recursive QTYPE=DS query with QNAME whose
|
* This is a non-recursive QTYPE=DS query with QNAME whose
|
||||||
@ -5655,7 +5653,7 @@ qctx_prepare_buffers(query_ctx_t *qctx, isc_buffer_t *buffer) {
|
|||||||
REQUIRE(buffer != NULL);
|
REQUIRE(buffer != NULL);
|
||||||
|
|
||||||
qctx->dbuf = ns_client_getnamebuf(qctx->client);
|
qctx->dbuf = ns_client_getnamebuf(qctx->client);
|
||||||
if (ISC_UNLIKELY(qctx->dbuf == NULL)) {
|
if (qctx->dbuf == NULL) {
|
||||||
CCTRACE(ISC_LOG_ERROR,
|
CCTRACE(ISC_LOG_ERROR,
|
||||||
"qctx_prepare_buffers: ns_client_getnamebuf "
|
"qctx_prepare_buffers: ns_client_getnamebuf "
|
||||||
"failed");
|
"failed");
|
||||||
@ -5663,7 +5661,7 @@ qctx_prepare_buffers(query_ctx_t *qctx, isc_buffer_t *buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, buffer);
|
qctx->fname = ns_client_newname(qctx->client, qctx->dbuf, buffer);
|
||||||
if (ISC_UNLIKELY(qctx->fname == NULL)) {
|
if (qctx->fname == NULL) {
|
||||||
CCTRACE(ISC_LOG_ERROR,
|
CCTRACE(ISC_LOG_ERROR,
|
||||||
"qctx_prepare_buffers: ns_client_newname failed");
|
"qctx_prepare_buffers: ns_client_newname failed");
|
||||||
|
|
||||||
@ -5671,7 +5669,7 @@ qctx_prepare_buffers(query_ctx_t *qctx, isc_buffer_t *buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
qctx->rdataset = ns_client_newrdataset(qctx->client);
|
qctx->rdataset = ns_client_newrdataset(qctx->client);
|
||||||
if (ISC_UNLIKELY(qctx->rdataset == NULL)) {
|
if (qctx->rdataset == NULL) {
|
||||||
CCTRACE(ISC_LOG_ERROR,
|
CCTRACE(ISC_LOG_ERROR,
|
||||||
"qctx_prepare_buffers: ns_client_newrdataset failed");
|
"qctx_prepare_buffers: ns_client_newrdataset failed");
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1654,7 +1654,6 @@
|
|||||||
./lib/isc/include/isc/iterated_hash.h C 2008,2014,2016,2018,2019,2020,2021
|
./lib/isc/include/isc/iterated_hash.h C 2008,2014,2016,2018,2019,2020,2021
|
||||||
./lib/isc/include/isc/lang.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020,2021
|
./lib/isc/include/isc/lang.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020,2021
|
||||||
./lib/isc/include/isc/lex.h C 1998,1999,2000,2001,2002,2004,2005,2007,2008,2015,2016,2017,2018,2019,2020,2021
|
./lib/isc/include/isc/lex.h C 1998,1999,2000,2001,2002,2004,2005,2007,2008,2015,2016,2017,2018,2019,2020,2021
|
||||||
./lib/isc/include/isc/likely.h C 2017,2018,2019,2020,2021
|
|
||||||
./lib/isc/include/isc/list.h C 1997,1998,1999,2000,2001,2002,2004,2006,2007,2011,2012,2013,2016,2018,2019,2020,2021
|
./lib/isc/include/isc/list.h C 1997,1998,1999,2000,2001,2002,2004,2006,2007,2011,2012,2013,2016,2018,2019,2020,2021
|
||||||
./lib/isc/include/isc/log.h C 1999,2000,2001,2002,2004,2005,2006,2007,2009,2014,2016,2017,2018,2019,2020,2021
|
./lib/isc/include/isc/log.h C 1999,2000,2001,2002,2004,2005,2006,2007,2009,2014,2016,2017,2018,2019,2020,2021
|
||||||
./lib/isc/include/isc/magic.h C 1999,2000,2001,2004,2005,2006,2007,2016,2017,2018,2019,2020,2021
|
./lib/isc/include/isc/magic.h C 1999,2000,2001,2004,2005,2006,2007,2016,2017,2018,2019,2020,2021
|
||||||
|
Loading…
x
Reference in New Issue
Block a user