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

Remove redundant parentheses from the return statement

This commit is contained in:
Ondřej Surý
2024-11-19 10:38:03 +01:00
parent 3873b0c279
commit 0258850f20
437 changed files with 10832 additions and 10856 deletions

View File

@@ -303,7 +303,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
if (ntabs > 0) {
isc_buffer_availableregion(target, &r);
if (r.length < (unsigned int)ntabs) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
p = r.base;
@@ -326,7 +326,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
isc_buffer_availableregion(target, &r);
if (r.length < (unsigned int)nspaces) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
p = r.base;
@@ -343,7 +343,7 @@ indent(unsigned int *current, unsigned int to, int tabwidth,
isc_buffer_add(target, nspaces);
*current = to;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -379,7 +379,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
isc_buffer_availableregion(&buf, &r);
if (r.length < 1) {
return (DNS_R_TEXTTOOLONG);
return DNS_R_TEXTTOOLONG;
}
r.base[0] = '\n';
isc_buffer_add(&buf, 1);
@@ -390,7 +390,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
unsigned int i, len = strlen(indentctx->string);
for (i = 0; i < indentctx->count; i++) {
if (isc_buffer_availablelength(&buf) < len) {
return (DNS_R_TEXTTOOLONG);
return DNS_R_TEXTTOOLONG;
}
isc_buffer_putstr(&buf, indentctx->string);
}
@@ -399,7 +399,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
if ((ctx->style.flags & DNS_STYLEFLAG_COMMENTDATA) != 0) {
isc_buffer_availableregion(&buf, &r);
if (r.length < 1) {
return (DNS_R_TEXTTOOLONG);
return DNS_R_TEXTTOOLONG;
}
r.base[0] = ';';
isc_buffer_add(&buf, 1);
@@ -415,15 +415,15 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
* so it won't help. Use DNS_R_TEXTTOOLONG as a substitute.
*/
if (result == ISC_R_NOSPACE) {
return (DNS_R_TEXTTOOLONG);
return DNS_R_TEXTTOOLONG;
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
isc_buffer_availableregion(&buf, &r);
if (r.length < 1) {
return (DNS_R_TEXTTOOLONG);
return DNS_R_TEXTTOOLONG;
}
r.base[0] = '\0';
isc_buffer_add(&buf, 1);
@@ -439,7 +439,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
ctx->serve_stale_ttl = 0;
ctx->indent = *indentctx;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
#define INDENT_TO(col) \
@@ -463,12 +463,12 @@ str_totext(const char *source, isc_buffer_t *target) {
l = strlen(source);
if (l > region.length) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(region.base, source, l);
isc_buffer_add(target, l);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -479,7 +479,7 @@ yaml_stringify(isc_buffer_t *target, char *start) {
isc_buffer_availableregion(target, &r);
if (r.length < 1) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
/* NUL terminate buffer for string operations below */
@@ -490,7 +490,7 @@ yaml_stringify(isc_buffer_t *target, char *start) {
isc_buffer_availableregion(target, &r);
/* Space to shift by 1 with trailing NUL? */
if (r.length < 2) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(tmp + 1, tmp,
(char *)isc_buffer_used(target) - tmp + 1);
@@ -499,7 +499,7 @@ yaml_stringify(isc_buffer_t *target, char *start) {
s = tmp + 2;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static isc_result_t
@@ -571,7 +571,7 @@ cleanup:
dns_rdataset_disassociate(&rds);
}
return (result);
return result;
}
/*
@@ -668,7 +668,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
result = dns_ttl_totext(rdataset->ttl, false,
false, target);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
column += target->used - length;
} else {
@@ -677,7 +677,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
INSIST(length <= sizeof(ttlbuf));
isc_buffer_availableregion(target, &r);
if (r.length < length) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
memmove(r.base, ttlbuf, length);
isc_buffer_add(target, length);
@@ -714,7 +714,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
rdataset->rdclass, target);
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
column += (target->used - class_start);
}
@@ -741,7 +741,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
if (isc_buffer_availablelength(target) <
(sizeof(KEYDATA) - 1))
{
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
isc_buffer_putstr(target, KEYDATA);
break;
@@ -757,7 +757,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
result = dns_rdatatype_totext(type, target);
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
column += (target->used - type_start);
@@ -803,7 +803,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
}
if (result != ISC_R_NOMORE) {
return (result);
return result;
}
/*
@@ -817,7 +817,7 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
ctx->current_ttl = current_ttl;
ctx->current_ttl_valid = current_ttl_valid;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -865,7 +865,7 @@ question_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
target);
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
column += (target->used - class_start);
}
@@ -882,7 +882,7 @@ question_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
result = dns_rdatatype_totext(rdataset->type, target);
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
column += (target->used - type_start);
}
@@ -893,7 +893,7 @@ question_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
}
RETERR(str_totext("\n", target));
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
@@ -904,7 +904,7 @@ dns_rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
result = totext_ctx_init(&dns_master_style_debug, NULL, &ctx);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("could not set master file style");
return (ISC_R_UNEXPECTED);
return ISC_R_UNEXPECTED;
}
/*
@@ -918,11 +918,11 @@ dns_rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name,
}
if (question) {
return (question_totext(rdataset, owner_name, &ctx,
omit_final_dot, target));
return question_totext(rdataset, owner_name, &ctx,
omit_final_dot, target);
} else {
return (rdataset_totext(rdataset, owner_name, &ctx,
omit_final_dot, target));
return rdataset_totext(rdataset, owner_name, &ctx,
omit_final_dot, target);
}
}
@@ -936,10 +936,10 @@ dns_master_rdatasettotext(const dns_name_t *owner_name,
result = totext_ctx_init(style, indent, &ctx);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("could not set master file style");
return (ISC_R_UNEXPECTED);
return ISC_R_UNEXPECTED;
}
return (rdataset_totext(rdataset, owner_name, &ctx, false, target));
return rdataset_totext(rdataset, owner_name, &ctx, false, target);
}
isc_result_t
@@ -952,10 +952,10 @@ dns_master_questiontotext(const dns_name_t *owner_name,
result = totext_ctx_init(style, NULL, &ctx);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("could not set master file style");
return (ISC_R_UNEXPECTED);
return ISC_R_UNEXPECTED;
}
return (question_totext(rdataset, owner_name, &ctx, false, target));
return question_totext(rdataset, owner_name, &ctx, false, target);
}
/*
@@ -1017,7 +1017,7 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, dns_rdataset_t *rdataset,
isc_buffer_init(buffer, newmem, newlength);
}
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
/*
@@ -1029,10 +1029,10 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name, dns_rdataset_t *rdataset,
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("master file write failed: %s",
isc_result_totext(result));
return (result);
return result;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -1066,13 +1066,13 @@ dump_order(const dns_rdataset_t *rds) {
t += 2;
break;
}
return ((t << 1) + sig);
return (t << 1) + sig;
}
static int
dump_order_compare(const void *a, const void *b) {
return (dump_order(*((const dns_rdataset_t *const *)a)) -
dump_order(*((const dns_rdataset_t *const *)b)));
return dump_order(*((const dns_rdataset_t *const *)a)) -
dump_order(*((const dns_rdataset_t *const *)b));
}
/*
@@ -1197,7 +1197,7 @@ again:
}
if (dumpresult != ISC_R_SUCCESS) {
return (dumpresult);
return dumpresult;
}
/*
@@ -1212,7 +1212,7 @@ again:
itresult = ISC_R_SUCCESS;
}
return (itresult);
return itresult;
}
/*
@@ -1294,7 +1294,7 @@ restart:
} while (result == ISC_R_SUCCESS);
if (result != ISC_R_NOMORE) {
return (result);
return result;
}
/*
@@ -1316,10 +1316,10 @@ restart:
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR("raw master file write failed: %s",
isc_result_totext(result));
return (result);
return result;
}
return (result);
return result;
}
static isc_result_t
@@ -1351,7 +1351,7 @@ dump_rdatasets_raw(isc_mem_t *mctx, const dns_name_t *owner_name,
}
dns_rdataset_disassociate(&rdataset);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
}
@@ -1359,7 +1359,7 @@ dump_rdatasets_raw(isc_mem_t *mctx, const dns_name_t *owner_name,
result = ISC_R_SUCCESS;
}
return (result);
return result;
}
/*
@@ -1422,13 +1422,13 @@ dns_dumpctx_detach(dns_dumpctx_t **dctxp) {
dns_dbversion_t *
dns_dumpctx_version(dns_dumpctx_t *dctx) {
REQUIRE(DNS_DCTX_VALID(dctx));
return (dctx->version);
return dctx->version;
}
dns_db_t *
dns_dumpctx_db(dns_dumpctx_t *dctx) {
REQUIRE(DNS_DCTX_VALID(dctx));
return (dctx->db);
return dctx->db;
}
void
@@ -1476,7 +1476,7 @@ flushandsync(FILE *f, isc_result_t result, const char *temp) {
isc_result_totext(result));
}
}
return (result);
return result;
}
static isc_result_t
@@ -1512,7 +1512,7 @@ closeandrename(FILE *f, isc_result_t result, const char *temp,
"dumping master file: rename: %s: %s", file,
isc_result_totext(result));
}
return (result);
return result;
}
/*
@@ -1625,7 +1625,7 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
isc_refcount_init(&dctx->references, 1);
dctx->magic = DNS_DCTX_MAGIC;
*dctxp = dctx;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
if (dctx->dbiter != NULL) {
@@ -1635,7 +1635,7 @@ cleanup:
dns_db_detach(&dctx->db);
}
isc_mem_put(mctx, dctx, sizeof(*dctx));
return (result);
return result;
}
static isc_result_t
@@ -1706,7 +1706,7 @@ writeheader(dns_dumpctx_t *dctx) {
}
isc_mem_put(dctx->mctx, buffer.base, buffer.length);
return (result);
return result;
}
static isc_result_t
@@ -1782,7 +1782,7 @@ dumptostream(dns_dumpctx_t *dctx) {
cleanup:
RUNTIME_CHECK(dns_dbiterator_pause(dctx->dbiter) == ISC_R_SUCCESS);
isc_mem_put(dctx->mctx, buffer.base, buffer.length);
return (result);
return result;
}
isc_result_t
@@ -1801,7 +1801,7 @@ dns_master_dumptostreamasync(isc_mem_t *mctx, dns_db_t *db,
result = dumpctx_create(mctx, db, version, style, f, &dctx,
dns_masterformat_text, NULL);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
dctx->done = done;
dctx->done_arg = done_arg;
@@ -1809,7 +1809,7 @@ dns_master_dumptostreamasync(isc_mem_t *mctx, dns_db_t *db,
dns_dumpctx_attach(dctx, dctxp);
isc_work_enqueue(loop, master_dump_cb, master_dump_done_cb, dctx);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
@@ -1823,7 +1823,7 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
result = dumpctx_create(mctx, db, version, style, f, &dctx, format,
header);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dumptostream(dctx);
@@ -1831,7 +1831,7 @@ dns_master_dumptostream(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
dns_dumpctx_detach(&dctx);
result = flushandsync(f, result, NULL);
return (result);
return result;
}
static isc_result_t
@@ -1864,11 +1864,11 @@ opentmp(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
*tempp = tempname;
*fp = f;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup:
isc_mem_free(mctx, tempname);
return (result);
return result;
}
isc_result_t
@@ -1904,7 +1904,7 @@ dns_master_dumpasync(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
dns_dumpctx_attach(dctx, dctxp);
isc_work_enqueue(loop, master_dump_cb, master_dump_done_cb, dctx);
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
cleanup_tempname:
(void)isc_stdio_close(f);
@@ -1914,7 +1914,7 @@ cleanup_tempname:
cleanup_file:
isc_mem_free(mctx, file);
return (result);
return result;
}
isc_result_t
@@ -1928,7 +1928,7 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
result = opentmp(mctx, filename, &tempname, &f);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
result = dumpctx_create(mctx, db, version, style, f, &dctx, format,
@@ -1945,13 +1945,13 @@ dns_master_dump(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
cleanup:
isc_mem_free(mctx, tempname);
return (result);
return result;
}
dns_masterstyle_flags_t
dns_master_styleflags(const dns_master_style_t *style) {
REQUIRE(style != NULL);
return (style->flags);
return style->flags;
}
isc_result_t
@@ -1975,7 +1975,7 @@ dns_master_stylecreate(dns_master_style_t **stylep,
style->tab_width = tab_width;
style->split_width = split_width;
*stylep = style;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
void