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

@@ -11,6 +11,7 @@
#include <config.h>
#include <stdbool.h>
#include <stddef.h>
#include <isc/app.h>
@@ -121,10 +122,10 @@ typedef struct resctx {
unsigned int magic;
isc_mutex_t lock;
dns_client_t *client;
isc_boolean_t want_dnssec;
isc_boolean_t want_validation;
isc_boolean_t want_cdflag;
isc_boolean_t want_tcp;
bool want_dnssec;
bool want_validation;
bool want_cdflag;
bool want_tcp;
/* Locked */
ISC_LINK(struct resctx) link;
@@ -137,7 +138,7 @@ typedef struct resctx {
dns_namelist_t namelist;
isc_result_t result;
dns_clientresevent_t *event;
isc_boolean_t canceled;
bool canceled;
dns_rdataset_t *rdataset;
dns_rdataset_t *sigrdataset;
} resctx_t;
@@ -156,7 +157,7 @@ typedef struct resarg {
isc_result_t vresult;
dns_namelist_t *namelist;
dns_clientrestrans_t *trans;
isc_boolean_t canceled;
bool canceled;
} resarg_t;
/*%
@@ -171,7 +172,7 @@ typedef struct reqctx {
/* Locked */
ISC_LINK(struct reqctx) link;
isc_boolean_t canceled;
bool canceled;
dns_tsigkey_t *tsigkey;
dns_request_t *request;
dns_clientreqevent_t *event;
@@ -189,7 +190,7 @@ typedef struct reqarg {
/* Locked */
isc_result_t result;
dns_clientreqtrans_t *trans;
isc_boolean_t canceled;
bool canceled;
} reqarg_t;
/*%
@@ -204,7 +205,7 @@ typedef struct updatearg {
/* Locked */
isc_result_t result;
dns_clientupdatetrans_t *trans;
isc_boolean_t canceled;
bool canceled;
} updatearg_t;
/*%
@@ -215,14 +216,14 @@ typedef struct updatectx {
unsigned int magic;
isc_mutex_t lock;
dns_client_t *client;
isc_boolean_t want_tcp;
bool want_tcp;
/* Locked */
dns_request_t *updatereq;
dns_request_t *soareq;
dns_clientrestrans_t *restrans;
dns_clientrestrans_t *restrans2;
isc_boolean_t canceled;
bool canceled;
/* Task Locked */
ISC_LINK(struct updatectx) link;
@@ -252,7 +253,7 @@ static isc_result_t send_update(updatectx_t *uctx);
static isc_result_t
getudpdispatch(int family, dns_dispatchmgr_t *dispatchmgr,
isc_socketmgr_t *socketmgr, isc_taskmgr_t *taskmgr,
isc_boolean_t is_shared, dns_dispatch_t **dispp,
bool is_shared, dns_dispatch_t **dispp,
const isc_sockaddr_t *localaddr)
{
unsigned int attrs, attrmask;
@@ -476,7 +477,7 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx,
client->dispatchv4 = NULL;
if (localaddr4 != NULL || localaddr6 == NULL) {
result = getudpdispatch(AF_INET, dispatchmgr, socketmgr,
taskmgr, ISC_TRUE,
taskmgr, true,
&dispatchv4, localaddr4);
if (result == ISC_R_SUCCESS)
client->dispatchv4 = dispatchv4;
@@ -485,7 +486,7 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx,
client->dispatchv6 = NULL;
if (localaddr6 != NULL || localaddr4 == NULL) {
result = getudpdispatch(AF_INET6, dispatchmgr, socketmgr,
taskmgr, ISC_TRUE,
taskmgr, true,
&dispatchv6, localaddr6);
if (result == ISC_R_SUCCESS)
client->dispatchv6 = dispatchv6;
@@ -586,7 +587,7 @@ destroyclient(dns_client_t **clientp) {
void
dns_client_destroy(dns_client_t **clientp) {
dns_client_t *client;
isc_boolean_t destroyok = ISC_FALSE;
bool destroyok = false;
REQUIRE(clientp != NULL);
client = *clientp;
@@ -597,7 +598,7 @@ dns_client_destroy(dns_client_t **clientp) {
if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
ISC_LIST_EMPTY(client->reqctxs) &&
ISC_LIST_EMPTY(client->updatectxs)) {
destroyok = ISC_TRUE;
destroyok = true;
}
UNLOCK(&client->lock);
@@ -796,8 +797,8 @@ view_find(resctx_t *rctx, dns_db_t **dbp, dns_dbnode_t **nodep,
else
type = rctx->type;
result = dns_view_find(rctx->view, name, type, 0, 0, ISC_FALSE,
ISC_FALSE, dbp, nodep, foundname,
result = dns_view_find(rctx->view, name, type, 0, 0, false,
false, dbp, nodep, foundname,
rctx->rdataset,
rctx->sigrdataset);
@@ -809,8 +810,8 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
isc_mem_t *mctx;
isc_result_t tresult, result = ISC_R_SUCCESS;
isc_result_t vresult = ISC_R_SUCCESS;
isc_boolean_t want_restart;
isc_boolean_t send_event = ISC_FALSE;
bool want_restart;
bool send_event = false;
dns_name_t *name, *prefix;
dns_fixedname_t foundname, fixed;
dns_rdataset_t *trdataset;
@@ -836,7 +837,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
dns_dbnode_t *node = NULL;
rctx->restarts++;
want_restart = ISC_FALSE;
want_restart = false;
if (event == NULL && !rctx->canceled) {
fname = dns_fixedname_initname(&foundname);
@@ -861,7 +862,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
if (rctx->sigrdataset != NULL)
putrdataset(mctx,
&rctx->sigrdataset);
send_event = ISC_TRUE;
send_event = true;
}
goto done;
}
@@ -907,7 +908,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
switch (result) {
case ISC_R_SUCCESS:
send_event = ISC_TRUE;
send_event = true;
/*
* This case is handled in the main line below.
*/
@@ -942,7 +943,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
tresult = dns_name_copy(&cname.cname, name, NULL);
dns_rdata_freestruct(&cname);
if (tresult == ISC_R_SUCCESS)
want_restart = ISC_TRUE;
want_restart = true;
else
result = tresult;
goto done;
@@ -988,7 +989,7 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
name, NULL);
dns_rdata_freestruct(&dname);
if (tresult == ISC_R_SUCCESS)
want_restart = ISC_TRUE;
want_restart = true;
else
result = tresult;
goto done;
@@ -1001,14 +1002,14 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
/* What about sigrdataset? */
if (rctx->sigrdataset != NULL)
putrdataset(mctx, &rctx->sigrdataset);
send_event = ISC_TRUE;
send_event = true;
goto done;
default:
if (rctx->rdataset != NULL)
putrdataset(mctx, &rctx->rdataset);
if (rctx->sigrdataset != NULL)
putrdataset(mctx, &rctx->sigrdataset);
send_event = ISC_TRUE;
send_event = true;
goto done;
}
@@ -1115,9 +1116,9 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
* Limit the number of restarts.
*/
if (want_restart && rctx->restarts == MAX_RESTARTS) {
want_restart = ISC_FALSE;
want_restart = false;
result = ISC_R_QUOTA;
send_event = ISC_TRUE;
send_event = true;
}
/*
@@ -1136,8 +1137,8 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) {
}
if (result != ISC_R_SUCCESS) {
want_restart = ISC_FALSE;
send_event = ISC_TRUE;
want_restart = false;
send_event = true;
}
}
} while (want_restart);
@@ -1253,7 +1254,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
resarg->result = DNS_R_SERVFAIL;
resarg->namelist = namelist;
resarg->trans = NULL;
resarg->canceled = ISC_FALSE;
resarg->canceled = false;
result = dns_client_startresolve(client, name, rdclass, type, options,
client->task, resolve_done, resarg,
&resarg->trans);
@@ -1285,7 +1286,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
* Unusual termination (perhaps due to signal). We need some
* tricky cleanup process.
*/
resarg->canceled = ISC_TRUE;
resarg->canceled = true;
dns_client_cancelresolve(resarg->trans);
UNLOCK(&resarg->lock);
@@ -1315,7 +1316,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
isc_mem_t *mctx;
isc_result_t result;
dns_rdataset_t *rdataset, *sigrdataset;
isc_boolean_t want_dnssec, want_validation, want_cdflag, want_tcp;
bool want_dnssec, want_validation, want_cdflag, want_tcp;
REQUIRE(DNS_CLIENT_VALID(client));
REQUIRE(transp != NULL && *transp == NULL);
@@ -1330,10 +1331,10 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
mctx = client->mctx;
rdataset = NULL;
sigrdataset = NULL;
want_dnssec = ISC_TF((options & DNS_CLIENTRESOPT_NODNSSEC) == 0);
want_validation = ISC_TF((options & DNS_CLIENTRESOPT_NOVALIDATE) == 0);
want_cdflag = ISC_TF((options & DNS_CLIENTRESOPT_NOCDFLAG) == 0);
want_tcp = ISC_TF((options & DNS_CLIENTRESOPT_TCP) != 0);
want_dnssec = !(options & DNS_CLIENTRESOPT_NODNSSEC);
want_validation = !(options & DNS_CLIENTRESOPT_NOVALIDATE);
want_cdflag = !(options & DNS_CLIENTRESOPT_NOCDFLAG);
want_tcp = (options & DNS_CLIENTRESOPT_TCP);
/*
* Prepare some intermediate resources
@@ -1382,7 +1383,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
rctx->client = client;
ISC_LINK_INIT(rctx, link);
rctx->canceled = ISC_FALSE;
rctx->canceled = false;
rctx->task = client->task;
rctx->type = type;
rctx->view = view;
@@ -1434,7 +1435,7 @@ dns_client_cancelresolve(dns_clientrestrans_t *trans) {
LOCK(&rctx->lock);
if (!rctx->canceled) {
rctx->canceled = ISC_TRUE;
rctx->canceled = true;
if (rctx->fetch != NULL)
dns_resolver_cancelfetch(rctx->fetch);
}
@@ -1466,7 +1467,7 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) {
resctx_t *rctx;
isc_mem_t *mctx;
dns_client_t *client;
isc_boolean_t need_destroyclient = ISC_FALSE;
bool need_destroyclient = false;
REQUIRE(transp != NULL);
rctx = (resctx_t *)*transp;
@@ -1494,7 +1495,7 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) {
if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
ISC_LIST_EMPTY(client->reqctxs) &&
ISC_LIST_EMPTY(client->updatectxs))
need_destroyclient = ISC_TRUE;
need_destroyclient = true;
UNLOCK(&client->lock);
@@ -1538,7 +1539,7 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_keytable_add(secroots, ISC_FALSE, ISC_FALSE, &dstkey);
result = dns_keytable_add(secroots, false, false, &dstkey);
cleanup:
if (dstkey != NULL)
@@ -1662,7 +1663,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage,
reqarg->actx = actx;
reqarg->client = client;
reqarg->trans = NULL;
reqarg->canceled = ISC_FALSE;
reqarg->canceled = false;
result = dns_client_startrequest(client, qmessage, rmessage, server,
options, parseoptions, tsec, timeout,
@@ -1689,7 +1690,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage,
* Unusual termination (perhaps due to signal). We need some
* tricky cleanup process.
*/
reqarg->canceled = ISC_TRUE;
reqarg->canceled = true;
dns_client_cancelresolve(reqarg->trans);
UNLOCK(&reqarg->lock);
@@ -1771,7 +1772,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
ctx->client = client;
ISC_LINK_INIT(ctx, link);
ctx->parseoptions = parseoptions;
ctx->canceled = ISC_FALSE;
ctx->canceled = false;
ctx->event = event;
ctx->event->rmessage = rmessage;
ctx->tsigkey = NULL;
@@ -1823,7 +1824,7 @@ dns_client_cancelrequest(dns_clientreqtrans_t *trans) {
LOCK(&ctx->lock);
if (!ctx->canceled) {
ctx->canceled = ISC_TRUE;
ctx->canceled = true;
if (ctx->request != NULL)
dns_request_cancel(ctx->request);
}
@@ -1836,7 +1837,7 @@ dns_client_destroyreqtrans(dns_clientreqtrans_t **transp) {
reqctx_t *ctx;
isc_mem_t *mctx;
dns_client_t *client;
isc_boolean_t need_destroyclient = ISC_FALSE;
bool need_destroyclient = false;
REQUIRE(transp != NULL);
ctx = (reqctx_t *)*transp;
@@ -1857,7 +1858,7 @@ dns_client_destroyreqtrans(dns_clientreqtrans_t **transp) {
if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
ISC_LIST_EMPTY(client->reqctxs) &&
ISC_LIST_EMPTY(client->updatectxs)) {
need_destroyclient = ISC_TRUE;
need_destroyclient = true;
}
UNLOCK(&client->lock);
@@ -2079,7 +2080,7 @@ resolveaddr_done(isc_task_t *task, isc_event_t *event) {
dns_name_t *name;
dns_rdataset_t *rdataset;
updatectx_t *uctx;
isc_boolean_t completed = ISC_FALSE;
bool completed = false;
UNUSED(task);
@@ -2172,7 +2173,7 @@ resolveaddr_done(isc_task_t *task, isc_event_t *event) {
LOCK(&uctx->lock);
if (uctx->restrans == NULL && uctx->restrans2 == NULL)
completed = ISC_TRUE;
completed = true;
UNLOCK(&uctx->lock);
if (completed) {
@@ -2271,8 +2272,8 @@ receive_soa(isc_task_t *task, isc_event_t *event) {
dns_name_t *name;
dns_message_t *soaquery = NULL;
isc_sockaddr_t *addr;
isc_boolean_t seencname = ISC_FALSE;
isc_boolean_t droplabel = ISC_FALSE;
bool seencname = false;
bool droplabel = false;
dns_name_t tname;
unsigned int nlabels, reqoptions;
@@ -2346,7 +2347,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) {
else if (pass == 1)
section = DNS_SECTION_AUTHORITY;
else {
droplabel = ISC_TRUE;
droplabel = true;
goto out;
}
@@ -2372,7 +2373,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) {
&tset) == ISC_R_SUCCESS
)
{
seencname = ISC_TRUE;
seencname = true;
break;
}
}
@@ -2386,7 +2387,7 @@ receive_soa(isc_task_t *task, isc_event_t *event) {
}
if (seencname) {
droplabel = ISC_TRUE;
droplabel = true;
goto out;
}
@@ -2722,7 +2723,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
uarg->client = client;
uarg->result = ISC_R_FAILURE;
uarg->trans = NULL;
uarg->canceled = ISC_FALSE;
uarg->canceled = false;
result = dns_client_startupdate(client, rdclass, zonename,
prerequisites, updates, servers,
@@ -2750,7 +2751,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
* Unusual termination (perhaps due to signal). We need some
* tricky cleanup process.
*/
uarg->canceled = ISC_TRUE;
uarg->canceled = true;
dns_client_cancelupdate(uarg->trans);
UNLOCK(&uarg->lock);
@@ -2825,7 +2826,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
dns_section_t section = DNS_SECTION_UPDATE;
isc_sockaddr_t *server, *sa = NULL;
dns_tsectype_t tsectype = dns_tsectype_none;
isc_boolean_t want_tcp;
bool want_tcp;
UNUSED(options);
@@ -2847,7 +2848,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
if (result != ISC_R_SUCCESS)
return (result);
want_tcp = ISC_TF((options & DNS_CLIENTUPDOPT_TCP) != 0);
want_tcp = (options & DNS_CLIENTUPDOPT_TCP);
/*
* Create a context and prepare some resources.
@@ -2873,7 +2874,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
uctx->state = dns_clientupdatestate_prepare;
uctx->view = view;
uctx->rdclass = rdclass;
uctx->canceled = ISC_FALSE;
uctx->canceled = false;
uctx->updatemsg = NULL;
uctx->soaquery = NULL;
uctx->updatereq = NULL;
@@ -3021,7 +3022,7 @@ dns_client_cancelupdate(dns_clientupdatetrans_t *trans) {
LOCK(&uctx->lock);
if (!uctx->canceled) {
uctx->canceled = ISC_TRUE;
uctx->canceled = true;
if (uctx->updatereq != NULL)
dns_request_cancel(uctx->updatereq);
if (uctx->soareq != NULL)
@@ -3040,7 +3041,7 @@ dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp) {
updatectx_t *uctx;
isc_mem_t *mctx;
dns_client_t *client;
isc_boolean_t need_destroyclient = ISC_FALSE;
bool need_destroyclient = false;
isc_sockaddr_t *sa;
REQUIRE(transp != NULL);
@@ -3068,7 +3069,7 @@ dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp) {
if (client->references == 0 && ISC_LIST_EMPTY(client->resctxs) &&
ISC_LIST_EMPTY(client->reqctxs) &&
ISC_LIST_EMPTY(client->updatectxs))
need_destroyclient = ISC_TRUE;
need_destroyclient = true;
UNLOCK(&client->lock);