2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Use coccinelle to add braces to nested single line statement

Both clang-tidy and uncrustify chokes on statement like this:

for (...)
	if (...)
		break;

This commit uses a very simple semantic patch (below) to add braces around such
statements.

Semantic patch used:

@@
statement S;
expression E;
@@

while (...)
- if (E) S
+ { if (E) { S } }

@@
statement S;
expression E;
@@

for (...;...;...)
- if (E) S
+ { if (E) { S } }

@@
statement S;
expression E;
@@

if (...)
- if (E) S
+ { if (E) { S } }
This commit is contained in:
Ondřej Surý
2020-02-13 18:16:57 +01:00
parent c823ed4f07
commit 36c6105e4f
43 changed files with 537 additions and 273 deletions

View File

@@ -610,10 +610,16 @@ grow_entries(isc_task_t *task, isc_event_t *ev)
/*
* Are we shutting down?
*/
for (i = 0; i < adb->nentries; i++)
if (adb->entry_sd[i])
for (i = 0; i < adb->nentries; i++) {
if (adb->entry_sd[i]) {
goto cleanup;
/*
* Grab all the resources we need.
*/
}
}
/*
* Grab all the resources we need.
*/
@@ -764,10 +770,16 @@ grow_names(isc_task_t *task, isc_event_t *ev)
/*
* Are we shutting down?
*/
for (i = 0; i < adb->nnames; i++)
if (adb->name_sd[i])
for (i = 0; i < adb->nnames; i++) {
if (adb->name_sd[i]) {
goto cleanup;
/*
* Grab all the resources we need.
*/
}
}
/*
* Grab all the resources we need.
*/
@@ -963,9 +975,11 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
link_entry(adb, addr_bucket, entry);
} else {
for (anh = ISC_LIST_HEAD(*hookhead); anh != NULL;
anh = ISC_LIST_NEXT(anh, plink))
if (anh->entry == foundentry)
anh = ISC_LIST_NEXT(anh, plink)) {
if (anh->entry == foundentry) {
break;
}
}
if (anh == NULL) {
foundentry->refcnt++;
foundentry->nh++;