2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +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

@@ -4478,10 +4478,18 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
(void)cfg_map_get(config, "view", &views);
if (views != NULL && options != NULL)
if (check_dual_stack(options, logctx) != ISC_R_SUCCESS)
if (views != NULL && options != NULL) {
if (check_dual_stack(options, logctx) != ISC_R_SUCCESS) {
result = ISC_R_FAILURE;
/*
* Use case insensitive comparision as not all file systems are
* case sensitive. This will prevent people using FOO.DB and foo.db
* on case sensitive file systems but that shouldn't be a major issue.
*/
}
}
/*
* Use case insensitive comparision as not all file systems are
* case sensitive. This will prevent people using FOO.DB and foo.db
@@ -4622,15 +4630,20 @@ bind9_check_namedconf(const cfg_obj_t *config, bool check_plugins,
aclname = cfg_obj_asstring(cfg_tuple_get(acl, "name"));
for (i = 0; i < sizeof(builtin) / sizeof(builtin[0]);
i++)
i++) {
if (strcasecmp(aclname, builtin[i]) == 0) {
cfg_obj_log(acl, logctx, ISC_LOG_ERROR,
"attempt to redefine "
"builtin acl '%s'",
aclname);
result = ISC_R_FAILURE;
break;
{
cfg_obj_log(acl, logctx,
ISC_LOG_ERROR,
"attempt to redefine "
"builtin acl '%s'",
aclname);
result = ISC_R_FAILURE;
break;
}
}
}
for (elt2 = cfg_list_next(elt); elt2 != NULL;
elt2 = cfg_list_next(elt2)) {