2
0
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:
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

@@ -15,6 +15,7 @@
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -108,7 +109,7 @@ LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_hour;
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_day;
LIBDNS_EXTERNAL_DATA extern unsigned int dns_zone_mkey_month;
static isc_boolean_t want_stats = ISC_FALSE;
static bool want_stats = false;
static char program_name[ISC_DIR_NAMEMAX] = "named";
static char absolute_conffile[ISC_DIR_PATHMAX];
static char saved_command_line[512];
@@ -119,22 +120,22 @@ static int maxudp = 0;
/*
* -T options:
*/
static isc_boolean_t clienttest = ISC_FALSE;
static isc_boolean_t dropedns = ISC_FALSE;
static isc_boolean_t noedns = ISC_FALSE;
static isc_boolean_t nosoa = ISC_FALSE;
static isc_boolean_t noaa = ISC_FALSE;
static bool clienttest = false;
static bool dropedns = false;
static bool noedns = false;
static bool nosoa = false;
static bool noaa = false;
static unsigned int delay = 0;
static isc_boolean_t nonearest = ISC_FALSE;
static isc_boolean_t notcp = ISC_FALSE;
static isc_boolean_t fixedlocal = ISC_FALSE;
static isc_boolean_t sigvalinsecs = ISC_FALSE;
static bool nonearest = false;
static bool notcp = false;
static bool fixedlocal = false;
static bool sigvalinsecs = false;
/*
* -4 and -6
*/
static isc_boolean_t disable6 = ISC_FALSE;
static isc_boolean_t disable4 = ISC_FALSE;
static bool disable6 = false;
static bool disable4 = false;
void
named_main_earlywarning(const char *format, ...) {
@@ -337,7 +338,7 @@ save_command_line(int argc, char *argv[]) {
char *dst;
char *eob;
const char truncated[] = "...";
isc_boolean_t quoted = ISC_FALSE;
bool quoted = false;
dst = saved_command_line;
eob = saved_command_line + sizeof(saved_command_line);
@@ -357,10 +358,10 @@ save_command_line(int argc, char *argv[]) {
*src == '-' || *src == '_' ||
*src == '.' || *src == '/') {
*dst++ = *src++;
quoted = ISC_FALSE;
quoted = false;
} else {
*dst++ = '\\';
quoted = ISC_TRUE;
quoted = true;
}
}
}
@@ -391,25 +392,25 @@ parse_int(char *arg, const char *desc) {
static struct flag_def {
const char *name;
unsigned int value;
isc_boolean_t negate;
bool negate;
} mem_debug_flags[] = {
{ "none", 0, ISC_FALSE },
{ "trace", ISC_MEM_DEBUGTRACE, ISC_FALSE },
{ "record", ISC_MEM_DEBUGRECORD, ISC_FALSE },
{ "usage", ISC_MEM_DEBUGUSAGE, ISC_FALSE },
{ "size", ISC_MEM_DEBUGSIZE, ISC_FALSE },
{ "mctx", ISC_MEM_DEBUGCTX, ISC_FALSE },
{ NULL, 0, ISC_FALSE }
{ "none", 0, false },
{ "trace", ISC_MEM_DEBUGTRACE, false },
{ "record", ISC_MEM_DEBUGRECORD, false },
{ "usage", ISC_MEM_DEBUGUSAGE, false },
{ "size", ISC_MEM_DEBUGSIZE, false },
{ "mctx", ISC_MEM_DEBUGCTX, false },
{ NULL, 0, false }
}, mem_context_flags[] = {
{ "external", ISC_MEMFLAG_INTERNAL, ISC_TRUE },
{ "fill", ISC_MEMFLAG_FILL, ISC_FALSE },
{ "nofill", ISC_MEMFLAG_FILL, ISC_TRUE },
{ NULL, 0, ISC_FALSE }
{ "external", ISC_MEMFLAG_INTERNAL, true },
{ "fill", ISC_MEMFLAG_FILL, false },
{ "nofill", ISC_MEMFLAG_FILL, true },
{ NULL, 0, false }
};
static void
set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
isc_boolean_t clear = ISC_FALSE;
bool clear = false;
for (;;) {
const struct flag_def *def;
@@ -422,7 +423,7 @@ set_flags(const char *arg, struct flag_def *defs, unsigned int *ret) {
if (arglen == (int)strlen(def->name) &&
memcmp(arg, def->name, arglen) == 0) {
if (def->value == 0)
clear = ISC_TRUE;
clear = true;
if (def->negate)
*ret &= ~(def->value);
else
@@ -480,29 +481,29 @@ parse_T_opt(char *option) {
* expected and assert otherwise.
*/
if (!strcmp(option, "clienttest")) {
clienttest = ISC_TRUE;
clienttest = true;
} else if (!strncmp(option, "delay=", 6)) {
delay = atoi(option + 6);
} else if (!strcmp(option, "dropedns")) {
dropedns = ISC_TRUE;
dropedns = true;
} else if (!strncmp(option, "dscp=", 5)) {
isc_dscp_check_value = atoi(option + 5);
} else if (!strcmp(option, "fixedlocal")) {
fixedlocal = ISC_TRUE;
fixedlocal = true;
} else if (!strcmp(option, "keepstderr")) {
named_g_keepstderr = ISC_TRUE;
named_g_keepstderr = true;
} else if (!strcmp(option, "noaa")) {
noaa = ISC_TRUE;
noaa = true;
} else if (!strcmp(option, "noedns")) {
noedns = ISC_TRUE;
noedns = true;
} else if (!strcmp(option, "nonearest")) {
nonearest = ISC_TRUE;
nonearest = true;
} else if (!strcmp(option, "nosoa")) {
nosoa = ISC_TRUE;
nosoa = true;
} else if (!strcmp(option, "nosyslog")) {
named_g_nosyslog = ISC_TRUE;
named_g_nosyslog = true;
} else if (!strcmp(option, "notcp")) {
notcp = ISC_TRUE;
notcp = true;
} else if (!strcmp(option, "maxudp512")) {
maxudp = 512;
} else if (!strcmp(option, "maxudp1460")) {
@@ -542,7 +543,7 @@ parse_T_opt(char *option) {
named_main_earlyfatal("bad mkeytimer");
}
} else if (!strcmp(option, "sigvalinsecs")) {
sigvalinsecs = ISC_TRUE;
sigvalinsecs = true;
} else if (!strncmp(option, "tat=", 4)) {
named_g_tat_interval = atoi(option + 4);
} else {
@@ -562,7 +563,7 @@ parse_command_line(int argc, char *argv[]) {
* NAMED_MAIN_ARGS is defined in main.h, so that it can be used
* both by named and by ntservice hooks.
*/
isc_commandline_errprint = ISC_FALSE;
isc_commandline_errprint = false;
while ((ch = isc_commandline_parse(argc, argv,
NAMED_MAIN_ARGS)) != -1)
{
@@ -575,7 +576,7 @@ parse_command_line(int argc, char *argv[]) {
named_main_earlyfatal("IPv4 not supported "
"by OS");
isc_net_disableipv6();
disable6 = ISC_TRUE;
disable6 = true;
break;
case '6':
if (disable6)
@@ -585,14 +586,14 @@ parse_command_line(int argc, char *argv[]) {
named_main_earlyfatal("IPv6 not supported "
"by OS");
isc_net_disableipv4();
disable4 = ISC_TRUE;
disable4 = true;
break;
case 'A':
parse_fuzz_arg();
break;
case 'c':
named_g_conffile = isc_commandline_argument;
named_g_conffileset = ISC_TRUE;
named_g_conffileset = true;
break;
case 'd':
named_g_debuglevel = parse_int(isc_commandline_argument,
@@ -605,11 +606,11 @@ parse_command_line(int argc, char *argv[]) {
named_g_engine = isc_commandline_argument;
break;
case 'f':
named_g_foreground = ISC_TRUE;
named_g_foreground = true;
break;
case 'g':
named_g_foreground = ISC_TRUE;
named_g_logstderr = ISC_TRUE;
named_g_foreground = true;
named_g_logstderr = true;
break;
case 'L':
named_g_logfile = isc_commandline_argument;
@@ -638,7 +639,7 @@ parse_command_line(int argc, char *argv[]) {
break;
case 's':
/* XXXRTH temporary syntax */
want_stats = ISC_TRUE;
want_stats = true;
break;
case 'S':
maxsocks = parse_int(isc_commandline_argument,
@@ -729,7 +730,7 @@ parse_command_line(int argc, char *argv[]) {
/* Obsolete. No longer in use. Ignore. */
break;
case 'X':
named_g_forcelock = ISC_TRUE;
named_g_forcelock = true;
if (strcasecmp(isc_commandline_argument, "none") != 0)
named_g_defaultlockfile =
isc_commandline_argument;
@@ -935,7 +936,7 @@ setup(void) {
*/
named_os_minprivs();
result = named_log_init(ISC_TF(named_g_username != NULL));
result = named_log_init(named_g_username != NULL);
if (result != ISC_R_SUCCESS)
named_main_earlyfatal("named_log_init() failed: %s",
isc_result_totext(result));
@@ -1171,27 +1172,27 @@ setup(void) {
* Modify server context according to command line options
*/
if (clienttest)
ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_CLIENTTEST, true);
if (dropedns)
ns_server_setoption(sctx, NS_SERVER_DROPEDNS, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_DROPEDNS, true);
if (noedns)
ns_server_setoption(sctx, NS_SERVER_NOEDNS, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_NOEDNS, true);
if (nosoa)
ns_server_setoption(sctx, NS_SERVER_NOSOA, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_NOSOA, true);
if (noaa)
ns_server_setoption(sctx, NS_SERVER_NOAA, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_NOAA, true);
if (nonearest)
ns_server_setoption(sctx, NS_SERVER_NONEAREST, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_NONEAREST, true);
if (notcp)
ns_server_setoption(sctx, NS_SERVER_NOTCP, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_NOTCP, true);
if (fixedlocal)
ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_FIXEDLOCAL, true);
if (disable4)
ns_server_setoption(sctx, NS_SERVER_DISABLE4, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_DISABLE4, true);
if (disable6)
ns_server_setoption(sctx, NS_SERVER_DISABLE6, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_DISABLE6, true);
if (sigvalinsecs)
ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, ISC_TRUE);
ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, true);
named_g_server->sctx->delay = delay;
}