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 commit67b68e06ad)36c6105eUse coccinelle to add braces to nested single line statementd14bb713Add copy of run-clang-tidy that can fixup the filepaths056e133cUse clang-tidy to add curly braces around one-line statements
This commit is contained in:
@@ -141,8 +141,9 @@ detail(dns_rbt_t *rbt, dns_name_t *name)
|
||||
if (node1 != NULL && node1->data != NULL) {
|
||||
printf(" data at node: ");
|
||||
print_name(node1->data);
|
||||
} else
|
||||
} else {
|
||||
printf(" no data at node.");
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) {
|
||||
printf("\n name from dns_rbt_findnode: ");
|
||||
@@ -156,22 +157,24 @@ detail(dns_rbt_t *rbt, dns_name_t *name)
|
||||
|
||||
result =
|
||||
dns_name_concatenate(foundname, origin, fullname, NULL);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
print_name(fullname);
|
||||
else
|
||||
} else {
|
||||
printf("%s\n", dns_result_totext(result));
|
||||
}
|
||||
printf("\n (foundname = ");
|
||||
print_name(foundname);
|
||||
printf(", origin = ");
|
||||
print_name(origin);
|
||||
printf(")\n");
|
||||
if (nodes_should_match && node1 != node2)
|
||||
if (nodes_should_match && node1 != node2) {
|
||||
printf(" nodes returned from each function "
|
||||
"DO NOT match!\n");
|
||||
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
printf("\n result from dns_rbtnodechain_current: %s\n",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
|
||||
printf(" level_matches = %u, level_count = %u\n", chain.level_matches,
|
||||
chain.level_count);
|
||||
@@ -198,7 +201,6 @@ iterate(dns_rbt_t *rbt, bool forward)
|
||||
|
||||
result =
|
||||
dns_rbtnodechain_first(&chain, rbt, &foundname, origin);
|
||||
|
||||
} else {
|
||||
printf("iterating backward\n");
|
||||
move = dns_rbtnodechain_prev;
|
||||
@@ -206,10 +208,9 @@ iterate(dns_rbt_t *rbt, bool forward)
|
||||
result = dns_rbtnodechain_last(&chain, rbt, &foundname, origin);
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN)
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) {
|
||||
printf("start not found!\n");
|
||||
|
||||
else {
|
||||
} else {
|
||||
for (;;) {
|
||||
if (result == DNS_R_NEWORIGIN) {
|
||||
printf(" new origin: ");
|
||||
@@ -221,11 +222,11 @@ iterate(dns_rbt_t *rbt, bool forward)
|
||||
result == DNS_R_NEWORIGIN) {
|
||||
print_name(&foundname);
|
||||
printf("\n");
|
||||
|
||||
} else {
|
||||
if (result != ISC_R_NOMORE)
|
||||
if (result != ISC_R_NOMORE) {
|
||||
printf("UNEXEPCTED ITERATION ERROR: %s",
|
||||
dns_result_totext(result));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -253,10 +254,11 @@ main(int argc, char **argv)
|
||||
void * data;
|
||||
|
||||
progname = strrchr(*argv, '/');
|
||||
if (progname != NULL)
|
||||
if (progname != NULL) {
|
||||
progname++;
|
||||
else
|
||||
} else {
|
||||
progname = *argv;
|
||||
}
|
||||
|
||||
while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) {
|
||||
switch (ch) {
|
||||
@@ -306,8 +308,9 @@ main(int argc, char **argv)
|
||||
|
||||
command = buffer + strspn(buffer, whitespace);
|
||||
|
||||
if (*command == '#')
|
||||
if (*command == '#') {
|
||||
continue;
|
||||
}
|
||||
|
||||
arg = strpbrk(command, whitespace);
|
||||
if (arg != NULL) {
|
||||
@@ -325,7 +328,6 @@ main(int argc, char **argv)
|
||||
name);
|
||||
PRINTERR(result);
|
||||
}
|
||||
|
||||
} else if (CMDCHECK("delete")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
@@ -335,7 +337,6 @@ main(int argc, char **argv)
|
||||
PRINTERR(result);
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
|
||||
} else if (CMDCHECK("nuke")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
@@ -347,7 +348,6 @@ main(int argc, char **argv)
|
||||
PRINTERR(result);
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
|
||||
} else if (CMDCHECK("search")) {
|
||||
name = create_name(arg);
|
||||
if (name != NULL) {
|
||||
@@ -385,7 +385,6 @@ main(int argc, char **argv)
|
||||
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
|
||||
} else if (CMDCHECK("check")) {
|
||||
/*
|
||||
* Or "chain". I know, I know. Lame name.
|
||||
@@ -403,24 +402,22 @@ main(int argc, char **argv)
|
||||
|
||||
delete_name(name, NULL);
|
||||
}
|
||||
|
||||
} else if (CMDCHECK("forward")) {
|
||||
iterate(rbt, true);
|
||||
|
||||
} else if (CMDCHECK("backward")) {
|
||||
iterate(rbt, false);
|
||||
|
||||
} else if (CMDCHECK("print")) {
|
||||
if (arg == NULL || *arg == '\0')
|
||||
if (arg == NULL || *arg == '\0') {
|
||||
dns_rbt_printtext(rbt, NULL, stdout);
|
||||
else
|
||||
} else {
|
||||
printf("usage: print\n");
|
||||
|
||||
}
|
||||
} else if (CMDCHECK("quit")) {
|
||||
if (arg == NULL || *arg == '\0')
|
||||
if (arg == NULL || *arg == '\0') {
|
||||
break;
|
||||
else
|
||||
} else {
|
||||
printf("usage: quit\n");
|
||||
}
|
||||
} else {
|
||||
printf("a(dd) NAME, d(elete) NAME, "
|
||||
"s(earch) NAME, p(rint), or q(uit)\n");
|
||||
@@ -430,8 +427,9 @@ main(int argc, char **argv)
|
||||
|
||||
dns_rbt_destroy(&rbt);
|
||||
|
||||
if (show_final_mem)
|
||||
if (show_final_mem) {
|
||||
isc_mem_stats(mctx, stderr);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user