mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Replace custom isc_boolean_t with C standard bool type
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/mem.h>
|
||||
#include <isc/print.h>
|
||||
#include <isc/refcount.h>
|
||||
@@ -47,8 +49,8 @@ struct dns_keynode {
|
||||
unsigned int magic;
|
||||
isc_refcount_t refcount;
|
||||
dst_key_t * key;
|
||||
isc_boolean_t managed;
|
||||
isc_boolean_t initial;
|
||||
bool managed;
|
||||
bool initial;
|
||||
struct dns_keynode * next;
|
||||
};
|
||||
|
||||
@@ -166,7 +168,7 @@ dns_keytable_detach(dns_keytable_t **keytablep) {
|
||||
* key as the one supplied in "keyp" and, if found, update it accordingly.
|
||||
*/
|
||||
static isc_result_t
|
||||
update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, isc_boolean_t initial) {
|
||||
update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, bool initial) {
|
||||
dns_keynode_t *knode;
|
||||
|
||||
REQUIRE(keyp != NULL && *keyp != NULL);
|
||||
@@ -206,8 +208,8 @@ update_keynode(dst_key_t **keyp, dns_rbtnode_t *node, isc_boolean_t initial) {
|
||||
*/
|
||||
static isc_result_t
|
||||
prepend_keynode(dst_key_t **keyp, dns_rbtnode_t *node,
|
||||
dns_keytable_t *keytable, isc_boolean_t managed,
|
||||
isc_boolean_t initial)
|
||||
dns_keytable_t *keytable, bool managed,
|
||||
bool initial)
|
||||
{
|
||||
dns_keynode_t *knode = NULL;
|
||||
isc_result_t result;
|
||||
@@ -244,7 +246,7 @@ prepend_keynode(dst_key_t **keyp, dns_rbtnode_t *node,
|
||||
* supplying key data which would allow the domain to be validated.
|
||||
*/
|
||||
static isc_result_t
|
||||
insert(dns_keytable_t *keytable, isc_boolean_t managed, isc_boolean_t initial,
|
||||
insert(dns_keytable_t *keytable, bool managed, bool initial,
|
||||
const dns_name_t *keyname, dst_key_t **keyp)
|
||||
{
|
||||
dns_rbtnode_t *node = NULL;
|
||||
@@ -306,8 +308,8 @@ insert(dns_keytable_t *keytable, isc_boolean_t managed, isc_boolean_t initial,
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed,
|
||||
isc_boolean_t initial, dst_key_t **keyp)
|
||||
dns_keytable_add(dns_keytable_t *keytable, bool managed,
|
||||
bool initial, dst_key_t **keyp)
|
||||
{
|
||||
REQUIRE(keyp != NULL && *keyp != NULL);
|
||||
REQUIRE(!initial || managed);
|
||||
@@ -316,7 +318,7 @@ dns_keytable_add(dns_keytable_t *keytable, isc_boolean_t managed,
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_marksecure(dns_keytable_t *keytable, const dns_name_t *name) {
|
||||
return (insert(keytable, ISC_TRUE, ISC_FALSE, name, NULL));
|
||||
return (insert(keytable, true, false, name, NULL));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -333,7 +335,7 @@ dns_keytable_delete(dns_keytable_t *keytable, const dns_name_t *keyname) {
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (node->data != NULL)
|
||||
result = dns_rbt_deletenode(keytable->table,
|
||||
node, ISC_FALSE);
|
||||
node, false);
|
||||
else
|
||||
result = ISC_R_NOTFOUND;
|
||||
} else if (result == DNS_R_PARTIALMATCH)
|
||||
@@ -371,16 +373,16 @@ dns_keytable_deletekeynode(dns_keytable_t *keytable, dst_key_t *dstkey) {
|
||||
|
||||
knode = node->data;
|
||||
if (knode->next == NULL && knode->key != NULL &&
|
||||
dst_key_compare(knode->key, dstkey) == ISC_TRUE)
|
||||
dst_key_compare(knode->key, dstkey) == true)
|
||||
{
|
||||
result = dns_rbt_deletenode(keytable->table, node, ISC_FALSE);
|
||||
result = dns_rbt_deletenode(keytable->table, node, false);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
kprev = (dns_keynode_t **) &node->data;
|
||||
while (knode != NULL) {
|
||||
if (knode->key != NULL &&
|
||||
dst_key_compare(knode->key, dstkey) == ISC_TRUE)
|
||||
dst_key_compare(knode->key, dstkey) == true)
|
||||
break;
|
||||
kprev = &knode->next;
|
||||
knode = knode->next;
|
||||
@@ -606,7 +608,7 @@ dns_keytable_detachkeynode(dns_keytable_t *keytable, dns_keynode_t **keynodep)
|
||||
|
||||
isc_result_t
|
||||
dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name,
|
||||
dns_name_t *foundname, isc_boolean_t *wantdnssecp)
|
||||
dns_name_t *foundname, bool *wantdnssecp)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_rbtnode_t *node = NULL;
|
||||
@@ -625,10 +627,10 @@ dns_keytable_issecuredomain(dns_keytable_t *keytable, const dns_name_t *name,
|
||||
NULL, DNS_RBTFIND_NOOPTIONS, NULL, NULL);
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
|
||||
INSIST(node->data != NULL);
|
||||
*wantdnssecp = ISC_TRUE;
|
||||
*wantdnssecp = true;
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (result == ISC_R_NOTFOUND) {
|
||||
*wantdnssecp = ISC_FALSE;
|
||||
*wantdnssecp = false;
|
||||
result = ISC_R_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -773,14 +775,14 @@ dns_keynode_key(dns_keynode_t *keynode) {
|
||||
return (keynode->key);
|
||||
}
|
||||
|
||||
isc_boolean_t
|
||||
bool
|
||||
dns_keynode_managed(dns_keynode_t *keynode) {
|
||||
REQUIRE(VALID_KEYNODE(keynode));
|
||||
|
||||
return (keynode->managed);
|
||||
}
|
||||
|
||||
isc_boolean_t
|
||||
bool
|
||||
dns_keynode_initial(dns_keynode_t *keynode) {
|
||||
REQUIRE(VALID_KEYNODE(keynode));
|
||||
|
||||
@@ -791,7 +793,7 @@ void
|
||||
dns_keynode_trust(dns_keynode_t *keynode) {
|
||||
REQUIRE(VALID_KEYNODE(keynode));
|
||||
|
||||
keynode->initial = ISC_FALSE;
|
||||
keynode->initial = false;
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
@@ -806,8 +808,8 @@ dns_keynode_create(isc_mem_t *mctx, dns_keynode_t **target) {
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
knode->magic = KEYNODE_MAGIC;
|
||||
knode->managed = ISC_FALSE;
|
||||
knode->initial = ISC_FALSE;
|
||||
knode->managed = false;
|
||||
knode->initial = false;
|
||||
knode->key = NULL;
|
||||
knode->next = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user