2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Make isc_result a static enum

Remove the dynamic registration of result codes.  Convert isc_result_t
from unsigned + #defines into 32-bit enum type in grand unified
<isc/result.h> header.  Keep the existing values of the result codes
even at the expense of the description and identifier tables being
unnecessary large.

Additionally, add couple of:

    switch (result) {
    [...]
    default:
        break;
    }

statements where compiler now complains about missing enum values in the
switch statement.
This commit is contained in:
Ondřej Surý
2021-10-04 17:14:53 +02:00
parent 804ec1bcaa
commit 2e3a2eecfe
153 changed files with 1088 additions and 1962 deletions

View File

@@ -50,6 +50,7 @@
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/resolver.h>
#include <dns/result.h>
#include <dns/stats.h>
#include <dns/tsig.h>
#include <dns/view.h>

View File

@@ -45,9 +45,9 @@
#include <isc/mem.h>
#include <isc/netmgr.h>
#include <isc/refcount.h>
#include <isc/result.h>
#include <dns/geoip.h>
#include <dns/result.h>
#include <ns/listenlist.h>
#include <ns/types.h>

View File

@@ -25,7 +25,8 @@
*** Imports
***/
#include <dns/result.h>
#include <isc/result.h>
#include <dns/types.h>
/***

View File

@@ -11,6 +11,7 @@
#include <isc/log.h>
#include <isc/print.h>
#include <isc/result.h>
#include <dns/message.h>
#include <dns/rdataset.h>

View File

@@ -21,6 +21,7 @@
#include <isc/once.h>
#include <isc/print.h>
#include <isc/random.h>
#include <isc/result.h>
#include <isc/rwlock.h>
#include <isc/serial.h>
#include <isc/stats.h>

View File

@@ -12,11 +12,11 @@
/*! \file */
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/util.h>
#include <dns/acl.h>
#include <dns/message.h>
#include <dns/result.h>
#include <ns/server.h>
#include <ns/sortlist.h>

View File

@@ -29,6 +29,7 @@
#include <isc/print.h>
#include <isc/random.h>
#include <isc/resource.h>
#include <isc/result.h>
#include <isc/socket.h>
#include <isc/stdio.h>
#include <isc/string.h>
@@ -42,7 +43,6 @@
#include <dns/fixedname.h>
#include <dns/log.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dns/view.h>
#include <dns/zone.h>
@@ -324,8 +324,6 @@ ns_test_begin(FILE *logfile, bool start_managers) {
CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL));
}
dns_result_register();
if (start_managers) {
CHECK(create_managers());
}

View File

@@ -18,12 +18,12 @@
#include <isc/hash.h>
#include <isc/log.h>
#include <isc/mem.h>
#include <isc/result.h>
#include <isc/string.h>
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <dns/result.h>
#include <dns/zone.h>
#include <ns/client.h>

View File

@@ -37,6 +37,7 @@
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/soa.h>
#include <dns/ssu.h>
#include <dns/tsig.h>
@@ -117,6 +118,8 @@
case DNS_R_YXRRSET: \
case DNS_R_NXRRSET: \
_what = "unsuccessful"; \
default: \
break; \
} \
update_log(client, zone, LOGLEVEL_PROTOCOL, \
"update %s: %s (%s)", _what, msg, \
@@ -140,6 +143,8 @@
case DNS_R_YXRRSET: \
case DNS_R_NXRRSET: \
_what = "unsuccessful"; \
default: \
break; \
} \
if (isc_log_wouldlog(ns_lctx, LOGLEVEL_PROTOCOL)) { \
char _nbuf[DNS_NAME_FORMATSIZE]; \
@@ -167,6 +172,8 @@
case DNS_R_YXRRSET: \
case DNS_R_NXRRSET: \
_what = "unsuccessful"; \
default: \
break; \
} \
if (isc_log_wouldlog(ns_lctx, LOGLEVEL_PROTOCOL)) { \
char _nbuf[DNS_NAME_FORMATSIZE]; \
@@ -1805,13 +1812,13 @@ check_mx(ns_client_t *client, dns_zone_t *zone, dns_db_t *db,
if (isaddress && (options & DNS_ZONEOPT_CHECKMXFAIL) != 0) {
update_log(client, zone, ISC_LOG_ERROR,
"%s/MX: '%s': %s", ownerbuf, namebuf,
dns_result_totext(DNS_R_MXISADDRESS));
isc_result_totext(DNS_R_MXISADDRESS));
ok = false;
} else if (isaddress) {
update_log(client, zone, ISC_LOG_WARNING,
"%s/MX: warning: '%s': %s", ownerbuf,
namebuf,
dns_result_totext(DNS_R_MXISADDRESS));
isc_result_totext(DNS_R_MXISADDRESS));
}
/*
@@ -2701,7 +2708,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"temp entry creation failed: "
"%s",
dns_result_totext(result));
isc_result_totext(result));
FAIL(ISC_R_UNEXPECTED);
}
} else {
@@ -3073,7 +3080,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
snprintf(rdstr, sizeof(rdstr),
"[dns_"
"rdata_totext failed: %s]",
dns_result_totext(result));
isc_result_totext(result));
len = strlen(rdstr);
} else {
len = (int)isc_buffer_usedlength(&buf);
@@ -3421,7 +3428,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS) {
update_log(client, zone, ISC_LOG_ERROR,
"dns_zone_signwithkey failed: %s",
dns_result_totext(result));
isc_result_totext(result));
}
}
@@ -3456,7 +3463,7 @@ update_action(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS) {
update_log(client, zone, ISC_LOG_ERROR,
"dns_zone_addnsec3chain failed: %s",
dns_result_totext(result));
isc_result_totext(result));
}
}
} else {

View File

@@ -15,6 +15,7 @@
#include <isc/formatcheck.h>
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/result.h>
#include <isc/stats.h>
#include <isc/util.h>
@@ -29,7 +30,6 @@
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/result.h>
#include <dns/rriterator.h>
#include <dns/soa.h>
#include <dns/stats.h>