2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Replace custom isc_boolean_t with C standard bool type

This commit is contained in:
Ondřej Surý
2018-04-17 08:29:14 -07:00
parent cb6a185c69
commit 994e656977
546 changed files with 10785 additions and 10367 deletions

View File

@@ -49,6 +49,7 @@
#include <config.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <isc/buffer.h>
@@ -183,7 +184,7 @@ typedef struct sdlz_rdatasetiter {
* Forward references.
*/
static isc_result_t getnodedata(dns_db_t *db, const dns_name_t *name,
isc_boolean_t create, unsigned int options,
bool create, unsigned int options,
dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo,
dns_dbnode_t **nodep);
@@ -346,14 +347,14 @@ destroy(dns_sdlz_db_t *sdlz) {
static void
detach(dns_db_t **dbp) {
dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)(*dbp);
isc_boolean_t need_destroy = ISC_FALSE;
bool need_destroy = false;
REQUIRE(VALID_SDLZDB(sdlz));
LOCK(&sdlz->refcnt_lock);
REQUIRE(sdlz->references > 0);
sdlz->references--;
if (sdlz->references == 0)
need_destroy = ISC_TRUE;
need_destroy = true;
UNLOCK(&sdlz->refcnt_lock);
if (need_destroy)
@@ -436,7 +437,7 @@ attachversion(dns_db_t *db, dns_dbversion_t *source, dns_dbversion_t **targetp)
}
static void
closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) {
closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)db;
char origin[DNS_NAME_MAXTEXT + 1];
@@ -535,7 +536,7 @@ destroynode(dns_sdlznode_t *node) {
}
static isc_result_t
getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
getnodedata(dns_db_t *db, const dns_name_t *name, bool create,
unsigned int options, dns_clientinfomethods_t *methods,
dns_clientinfo_t *clientinfo, dns_dbnode_t **nodep)
{
@@ -546,14 +547,14 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
char namestr[DNS_NAME_MAXTEXT + 1];
isc_buffer_t b2;
char zonestr[DNS_NAME_MAXTEXT + 1];
isc_boolean_t isorigin;
bool isorigin;
dns_sdlzauthorityfunc_t authority;
REQUIRE(VALID_SDLZDB(sdlz));
REQUIRE(nodep != NULL && *nodep == NULL);
if (sdlz->dlzimp->methods->newversion == NULL) {
REQUIRE(create == ISC_FALSE);
REQUIRE(create == false);
}
isc_buffer_init(&b, namestr, sizeof(namestr));
@@ -565,18 +566,18 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
dns_name_countlabels(&sdlz->common.origin);
dns_name_init(&relname, NULL);
dns_name_getlabelsequence(name, 0, labels, &relname);
result = dns_name_totext(&relname, ISC_TRUE, &b);
result = dns_name_totext(&relname, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
} else {
result = dns_name_totext(name, ISC_TRUE, &b);
result = dns_name_totext(name, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
}
isc_buffer_putuint8(&b, 0);
isc_buffer_init(&b2, zonestr, sizeof(zonestr));
result = dns_name_totext(&sdlz->common.origin, ISC_TRUE, &b2);
result = dns_name_totext(&sdlz->common.origin, true, &b2);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_putuint8(&b2, 0);
@@ -637,7 +638,7 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
}
isc_buffer_init(&b, wildstr, sizeof(wildstr));
result = dns_name_totext(wild, ISC_TRUE, &b);
result = dns_name_totext(wild, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_putuint8(&b, 0);
@@ -697,7 +698,7 @@ getnodedata(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
}
static isc_result_t
findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
findnodeext(dns_db_t *db, const dns_name_t *name, bool create,
dns_clientinfomethods_t *methods, dns_clientinfo_t *clientinfo,
dns_dbnode_t **nodep)
{
@@ -705,7 +706,7 @@ findnodeext(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
}
static isc_result_t
findnode(dns_db_t *db, const dns_name_t *name, isc_boolean_t create,
findnode(dns_db_t *db, const dns_name_t *name, bool create,
dns_dbnode_t **nodep)
{
return (getnodedata(db, name, create, 0, NULL, NULL, nodep));
@@ -750,7 +751,7 @@ static void
detachnode(dns_db_t *db, dns_dbnode_t **targetp) {
dns_sdlz_db_t *sdlz = (dns_sdlz_db_t *)db;
dns_sdlznode_t *node;
isc_boolean_t need_destroy = ISC_FALSE;
bool need_destroy = false;
REQUIRE(VALID_SDLZDB(sdlz));
REQUIRE(targetp != NULL && *targetp != NULL);
@@ -763,7 +764,7 @@ detachnode(dns_db_t *db, dns_dbnode_t **targetp) {
INSIST(node->references > 0);
node->references--;
if (node->references == 0)
need_destroy = ISC_TRUE;
need_destroy = true;
UNLOCK(&node->lock);
if (need_destroy)
@@ -808,7 +809,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
return (ISC_R_NOTIMPLEMENTED);
isc_buffer_init(&b, zonestr, sizeof(zonestr));
result = dns_name_totext(&sdlz->common.origin, ISC_TRUE, &b);
result = dns_name_totext(&sdlz->common.origin, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_putuint8(&b, 0);
@@ -820,7 +821,7 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
sdlziter->common.methods = &dbiterator_methods;
sdlziter->common.db = NULL;
dns_db_attach(db, &sdlziter->common.db);
sdlziter->common.relative_names = ISC_TF(options & DNS_DB_RELATIVENAMES);
sdlziter->common.relative_names = (options & DNS_DB_RELATIVENAMES);
sdlziter->common.magic = DNS_DBITERATOR_MAGIC;
ISC_LIST_INIT(sdlziter->nodelist);
sdlziter->current = NULL;
@@ -938,7 +939,7 @@ findext(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
* Look up the next label.
*/
dns_name_getlabelsequence(name, nlabels - i, i, xname);
result = getnodedata(db, xname, ISC_FALSE, options,
result = getnodedata(db, xname, false, options,
methods, clientinfo, &node);
if (result == ISC_R_NOTFOUND) {
result = DNS_R_NXDOMAIN;
@@ -1233,11 +1234,11 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
return (result);
}
static isc_boolean_t
static bool
issecure(dns_db_t *db) {
UNUSED(db);
return (ISC_FALSE);
return (false);
}
static unsigned int
@@ -1247,14 +1248,14 @@ nodecount(dns_db_t *db) {
return (0);
}
static isc_boolean_t
static bool
ispersistent(dns_db_t *db) {
UNUSED(db);
return (ISC_TRUE);
return (true);
}
static void
overmem(dns_db_t *db, isc_boolean_t over) {
overmem(dns_db_t *db, bool over) {
UNUSED(db);
UNUSED(over);
}
@@ -1278,7 +1279,7 @@ getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) {
if (sdlz->dlzimp->methods->newversion == NULL)
return (ISC_R_NOTIMPLEMENTED);
result = getnodedata(db, &sdlz->common.origin, ISC_FALSE,
result = getnodedata(db, &sdlz->common.origin, false,
0, NULL, NULL, nodep);
if (result != ISC_R_SUCCESS)
sdlz_log(ISC_LOG_ERROR, "sdlz getoriginnode failed: %s",
@@ -1606,7 +1607,7 @@ dns_sdlzallowzonexfr(void *driverarg, void *dbdata, isc_mem_t *mctx,
/* Convert DNS name to ascii text */
isc_buffer_init(&b, namestr, sizeof(namestr));
result = dns_name_totext(name, ISC_TRUE, &b);
result = dns_name_totext(name, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_putuint8(&b, 0);
@@ -1720,7 +1721,7 @@ dns_sdlzfindzone(void *driverarg, void *dbdata, isc_mem_t *mctx,
/* Convert DNS name to ascii text */
isc_buffer_init(&b, namestr, sizeof(namestr));
result = dns_name_totext(name, ISC_TRUE, &b);
result = dns_name_totext(name, true, &b);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_putuint8(&b, 0);
@@ -1770,7 +1771,7 @@ dns_sdlzconfigure(void *driverarg, void *dbdata,
return (result);
}
static isc_boolean_t
static bool
dns_sdlzssumatch(const dns_name_t *signer, const dns_name_t *name,
const isc_netaddr_t *tcpaddr, dns_rdatatype_t type,
const dst_key_t *key, void *driverarg, void *dbdata)
@@ -1784,13 +1785,13 @@ dns_sdlzssumatch(const dns_name_t *signer, const dns_name_t *name,
isc_buffer_t *tkey_token = NULL;
isc_region_t token_region = { NULL, 0 };
uint32_t token_len = 0;
isc_boolean_t ret;
bool ret;
REQUIRE(driverarg != NULL);
imp = (dns_sdlzimplementation_t *) driverarg;
if (imp->methods->ssumatch == NULL)
return (ISC_FALSE);
return (false);
/*
* Format the request elements. sdlz operates on strings, not
@@ -1930,7 +1931,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
result = dns_rdata_fromtext(rdata, rdatalist->rdclass,
rdatalist->type, lex,
origin, ISC_FALSE,
origin, false,
mctx, rdatabuf,
&lookup->callbacks);
if (result != ISC_R_SUCCESS)