2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +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

@@ -21,6 +21,7 @@
#include <isc/mem.h>
#include <isc/print.h>
#include <isc/refcount.h>
#include <isc/result.h>
#include <isc/serial.h>
#include <isc/stdio.h>
#include <isc/stdtime.h>
@@ -39,7 +40,6 @@
#include <dns/rdataset.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
#include <dns/result.h>
#include <dns/soa.h>
#include <dns/time.h>
#include <dns/ttl.h>
@@ -305,18 +305,18 @@ loadctx_destroy(dns_loadctx_t *lctx);
result == ISC_R_NOPERM) \
(*callbacks->error)(callbacks, "%s: %s:%lu: %s: %s", \
"dns_master_load", source, line, filename, \
dns_result_totext(result)); \
isc_result_totext(result)); \
else \
LOGIT(result)
#define LOGIT(result) \
if (result == ISC_R_NOMEMORY) \
(*callbacks->error)(callbacks, "dns_master_load: %s", \
dns_result_totext(result)); \
isc_result_totext(result)); \
else \
(*callbacks->error)(callbacks, "%s: %s:%lu: %s", \
"dns_master_load", source, line, \
dns_result_totext(result))
isc_result_totext(result))
static unsigned char in_addr_arpa_data[] = "\007IN-ADDR\004ARPA";
static unsigned char in_addr_arpa_offsets[] = { 0, 8, 13 };
@@ -914,10 +914,10 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs,
error_cleanup:
if (result == ISC_R_NOMEMORY) {
(*callbacks->error)(callbacks, "$GENERATE: %s",
dns_result_totext(result));
isc_result_totext(result));
} else {
(*callbacks->error)(callbacks, "$GENERATE: %s:%lu: %s", source,
line, dns_result_totext(result));
line, isc_result_totext(result));
}
insist_cleanup:
@@ -1738,7 +1738,7 @@ load_text(dns_loadctx_t *lctx) {
dns_rdatatype_format(type, typebuf, sizeof(typebuf));
(*callbacks->error)(callbacks, "%s:%lu: %s '%s': %s",
source, line, "type", typebuf,
dns_result_totext(result));
isc_result_totext(result));
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);
} else {
@@ -1758,7 +1758,7 @@ load_text(dns_loadctx_t *lctx) {
dns_rdatatype_format(type, typebuf, sizeof(typebuf));
(*callbacks->error)(callbacks, "%s:%lu: %s '%s': %s",
source, line, "type", typebuf,
dns_result_totext(result));
isc_result_totext(result));
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);
} else {
@@ -1817,7 +1817,7 @@ load_text(dns_loadctx_t *lctx) {
const char *desc;
dns_name_format(name, namebuf, sizeof(namebuf));
result = DNS_R_BADOWNERNAME;
desc = dns_result_totext(result);
desc = isc_result_totext(result);
if (CHECKNAMESFAIL(lctx->options) ||
type == dns_rdatatype_nsec3) {
(*callbacks->error)(
@@ -2614,7 +2614,7 @@ cleanup:
}
if (result != ISC_R_SUCCESS && result != DNS_R_CONTINUE) {
(*callbacks->error)(callbacks, "dns_master_load: %s",
dns_result_totext(result));
isc_result_totext(result));
}
return (result);
@@ -3064,17 +3064,17 @@ commit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx,
&dataset));
if (result == ISC_R_NOMEMORY) {
(*error)(callbacks, "dns_master_load: %s",
dns_result_totext(result));
isc_result_totext(result));
} else if (result != ISC_R_SUCCESS) {
dns_name_format(owner, namebuf, sizeof(namebuf));
if (source != NULL) {
(*error)(callbacks, "%s: %s:%lu: %s: %s",
"dns_master_load", source, line,
namebuf, dns_result_totext(result));
namebuf, isc_result_totext(result));
} else {
(*error)(callbacks, "%s: %s: %s",
"dns_master_load", namebuf,
dns_result_totext(result));
isc_result_totext(result));
}
}
if (MANYERRS(lctx, result)) {