Merge branch '46-add-curly-braces' into 'master'

Add curly braces using uncrustify and then reformat with clang-format back

Closes #46

See merge request isc-projects/bind9!3057

(cherry picked from commit 67b68e06ad)

36c6105e Use coccinelle to add braces to nested single line statement
d14bb713 Add copy of run-clang-tidy that can fixup the filepaths
056e133c Use clang-tidy to add curly braces around one-line statements
This commit is contained in:
Ondřej Surý
2020-02-13 21:28:07 +00:00
parent 6270e602ea
commit 2e55baddd8
639 changed files with 29724 additions and 17080 deletions

View File

@@ -60,16 +60,19 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node)
result = dns_rdatasetiter_first(rdsiter);
while (result == ISC_R_SUCCESS) {
dns_rdatasetiter_current(rdsiter, &rdataset);
if (rdataset.type != dns_rdatatype_nsec)
if (rdataset.type != dns_rdatatype_nsec) {
active = true;
}
dns_rdataset_disassociate(&rdataset);
if (!active)
if (!active) {
result = dns_rdatasetiter_next(rdsiter);
else
} else {
result = ISC_R_NOMORE;
}
}
if (result != ISC_R_NOMORE)
if (result != ISC_R_NOMORE) {
fatal("rdataset iteration failed");
}
dns_rdatasetiter_destroy(&rdsiter);
if (!active) {
@@ -78,8 +81,9 @@ active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node)
*/
result = dns_db_deleterdataset(db, node, version,
dns_rdatatype_nsec, 0);
if (result == DNS_R_UNCHANGED)
if (result == DNS_R_UNCHANGED) {
result = ISC_R_SUCCESS;
}
check_result(result, "dns_db_deleterdataset");
}
@@ -127,10 +131,11 @@ nsecify(char *filename)
nextname = dns_fixedname_initname(&fnextname);
origintext = strrchr(filename, '/');
if (origintext == NULL)
if (origintext == NULL) {
origintext = filename;
else
} else {
origintext++; /* Skip '/'. */
}
len = strlen(origintext);
isc_buffer_constinit(&b, origintext, len);
isc_buffer_add(&b, len);
@@ -142,8 +147,9 @@ nsecify(char *filename)
dns_rdataclass_in, 0, NULL, &db);
check_result(result, "dns_db_create()");
result = dns_db_load(db, filename, dns_masterformat_text, 0);
if (result == DNS_R_SEENINCLUDE)
if (result == DNS_R_SEENINCLUDE) {
result = ISC_R_SUCCESS;
}
check_result(result, "dns_db_load()");
wversion = NULL;
result = dns_db_newversion(db, &wversion);
@@ -158,14 +164,15 @@ nsecify(char *filename)
while (result == ISC_R_SUCCESS) {
nextnode = NULL;
result = dns_dbiterator_next(dbiter);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS) {
result = next_active(db, wversion, dbiter, nextname,
&nextnode);
if (result == ISC_R_SUCCESS)
}
if (result == ISC_R_SUCCESS) {
target = nextname;
else if (result == ISC_R_NOMORE)
} else if (result == ISC_R_NOMORE) {
target = dns_db_origin(db);
else {
} else {
target = NULL; /* Make compiler happy. */
fatal("db iteration failed");
}
@@ -173,16 +180,18 @@ nsecify(char *filename)
dns_db_detachnode(db, &node);
node = nextnode;
}
if (result != ISC_R_NOMORE)
if (result != ISC_R_NOMORE) {
fatal("db iteration failed");
}
dns_dbiterator_destroy(&dbiter);
/*
* XXXRTH For now, we don't increment the SOA serial.
*/
dns_db_closeversion(db, &wversion, true);
len = strlen(filename);
if (len + 4 + 1 > sizeof(newfilename))
if (len + 4 + 1 > sizeof(newfilename)) {
fatal("filename too long");
}
snprintf(newfilename, sizeof(newfilename), "%s.new", filename);
result = dns_db_dump(db, NULL, newfilename);
check_result(result, "dns_db_dump");
@@ -201,8 +210,9 @@ main(int argc, char *argv[])
argc--;
argv++;
for (i = 0; i < argc; i++)
for (i = 0; i < argc; i++) {
nsecify(argv[i]);
}
/* isc_mem_stats(mctx, stdout); */
isc_mem_destroy(&mctx);