2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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

@@ -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 {