2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 21:47:59 +00:00

remove unused functions in dns_master

dns_master_dumpnode() and dns_master_dumpnodetostream() were
never used and can be removed.
This commit is contained in:
Evan Hunt 2023-10-02 13:52:58 -07:00
parent b92c3d9864
commit 50dd6aad34
2 changed files with 0 additions and 98 deletions

View File

@ -336,17 +336,6 @@ dns_master_questiontotext(const dns_name_t *owner_name,
const dns_master_style_t *style,
isc_buffer_t *target);
isc_result_t
dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
dns_dbversion_t *version, dns_dbnode_t *node,
const dns_name_t *name,
const dns_master_style_t *style, FILE *f);
isc_result_t
dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
dns_dbnode_t *node, const dns_name_t *name,
const dns_master_style_t *style, const char *filename);
dns_masterstyle_flags_t
dns_master_styleflags(const dns_master_style_t *style);

View File

@ -1908,93 +1908,6 @@ cleanup:
return (result);
}
/*
* Dump a database node into a master file.
* XXX: this function assumes the text format.
*/
isc_result_t
dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db,
dns_dbversion_t *version, dns_dbnode_t *node,
const dns_name_t *name,
const dns_master_style_t *style, FILE *f) {
isc_result_t result;
isc_buffer_t buffer;
char *bufmem;
isc_stdtime_t now = isc_stdtime_now();
dns_totext_ctx_t ctx;
dns_rdatasetiter_t *rdsiter = NULL;
unsigned int options = DNS_DB_STALEOK;
if ((style->flags & DNS_STYLEFLAG_EXPIRED) != 0) {
options |= DNS_DB_EXPIREDOK;
}
result = totext_ctx_init(style, NULL, &ctx);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("could not set master file style");
return (ISC_R_UNEXPECTED);
}
bufmem = isc_mem_get(mctx, initial_buffer_length);
isc_buffer_init(&buffer, bufmem, initial_buffer_length);
result = dns_db_allrdatasets(db, node, version, options, now, &rdsiter);
if (result != ISC_R_SUCCESS) {
goto failure;
}
result = dump_rdatasets_text(mctx, name, rdsiter, &ctx, &buffer, f);
if (result != ISC_R_SUCCESS) {
goto failure;
}
dns_rdatasetiter_destroy(&rdsiter);
result = ISC_R_SUCCESS;
failure:
isc_mem_put(mctx, buffer.base, buffer.length);
return (result);
}
isc_result_t
dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
dns_dbnode_t *node, const dns_name_t *name,
const dns_master_style_t *style, const char *filename) {
FILE *f = NULL;
isc_result_t result;
result = isc_stdio_open(filename, "w", &f);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
"dumping node to file: %s: open: %s", filename,
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = dns_master_dumpnodetostream(mctx, db, version, node, name,
style, f);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
"dumping master file: %s: dump: %s", filename,
isc_result_totext(result));
(void)isc_stdio_close(f);
return (ISC_R_UNEXPECTED);
}
result = isc_stdio_close(f);
if (result != ISC_R_SUCCESS) {
isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL,
DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR,
"dumping master file: %s: close: %s", filename,
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
return (result);
}
dns_masterstyle_flags_t
dns_master_styleflags(const dns_master_style_t *style) {
REQUIRE(style != NULL);