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

Use ControlStatementsExceptControlMacros for SpaceBeforeParens

> Put a space before opening parentheses only after control statement
> keywords (for/if/while...) except this option doesn’t apply to ForEach
> and If macros. This is useful in projects where ForEach/If macros are
> treated as function calls instead of control statements.

(cherry picked from commit 42496f3f4a)
This commit is contained in:
Ondřej Surý
2025-08-19 07:14:45 +02:00
parent 58791b5cfe
commit 8f8fb10232
7 changed files with 20 additions and 18 deletions

View File

@@ -82,3 +82,4 @@ ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros

View File

@@ -81,3 +81,4 @@ Standard: Cpp11
ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros

View File

@@ -462,8 +462,7 @@ static void
dns__acl_destroy_port_transports(dns_acl_t *acl) {
dns_acl_port_transports_t *port_proto = NULL;
dns_acl_port_transports_t *next = NULL;
ISC_LIST_FOREACH_SAFE (acl->ports_and_transports, port_proto, link,
next)
ISC_LIST_FOREACH_SAFE(acl->ports_and_transports, port_proto, link, next)
{
ISC_LIST_DEQUEUE(acl->ports_and_transports, port_proto, link);
isc_mem_put(acl->mctx, port_proto, sizeof(*port_proto));

View File

@@ -472,7 +472,7 @@ static void
msgresetname(dns_message_t *msg, dns_name_t *name) {
dns_rdataset_t *rds = NULL, *next_rds = NULL;
ISC_LIST_FOREACH_SAFE (name->list, rds, link, next_rds) {
ISC_LIST_FOREACH_SAFE(name->list, rds, link, next_rds) {
ISC_LIST_UNLINK(name->list, rds, link);
dns__message_putassociatedrdataset(msg, &rds);
@@ -485,8 +485,7 @@ msgresetnames(dns_message_t *msg, unsigned int first_section) {
for (size_t i = first_section; i < DNS_SECTION_MAX; i++) {
dns_name_t *name = NULL, *next_name = NULL;
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link, next_name)
{
ISC_LIST_FOREACH_SAFE(msg->sections[i], name, link, next_name) {
ISC_LIST_UNLINK(msg->sections[i], name, link);
msgresetname(msg, name);
@@ -814,7 +813,7 @@ findname(dns_name_t **foundname, const dns_name_t *target,
dns_namelist_t *section) {
dns_name_t *name = NULL;
ISC_LIST_FOREACH_REV (*section, name, link) {
ISC_LIST_FOREACH_REV(*section, name, link) {
if (dns_name_equal(name, target)) {
if (foundname != NULL) {
*foundname = name;
@@ -855,7 +854,7 @@ dns_message_findtype(const dns_name_t *name, dns_rdatatype_t type,
REQUIRE(name != NULL);
REQUIRE(rdatasetp == NULL || *rdatasetp == NULL);
ISC_LIST_FOREACH_REV (name->list, rds, link) {
ISC_LIST_FOREACH_REV(name->list, rds, link) {
if (rds->type == type && rds->covers == covers) {
SET_IF_NOT_NULL(rdatasetp, rds);
@@ -971,7 +970,7 @@ getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
static void
cleanup_name_hashmaps(dns_namelist_t *section) {
dns_name_t *name = NULL;
ISC_LIST_FOREACH (*section, name, link) {
ISC_LIST_FOREACH(*section, name, link) {
if (name->hashmap != NULL) {
isc_hashmap_destroy(&name->hashmap);
}
@@ -2415,9 +2414,9 @@ dns_message_renderreset(dns_message_t *msg) {
msg->cursors[i] = NULL;
msg->counts[i] = 0;
ISC_LIST_FOREACH (msg->sections[i], name, link) {
ISC_LIST_FOREACH(msg->sections[i], name, link) {
dns_rdataset_t *rds = NULL;
ISC_LIST_FOREACH (name->list, rds, link) {
ISC_LIST_FOREACH(name->list, rds, link) {
rds->attributes &= ~DNS_RDATASETATTR_RENDERED;
}
}
@@ -3417,7 +3416,7 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section,
dns_message_currentname(msg, section, &name);
dns_rdataset_t *rds = NULL;
ISC_LIST_FOREACH (name->list, rds, link) {
ISC_LIST_FOREACH(name->list, rds, link) {
if (section == DNS_SECTION_ANSWER &&
rds->type == dns_rdatatype_soa)
{
@@ -5072,7 +5071,7 @@ message_authority_soa_min(dns_message_t *msg, dns_ttl_t *ttlp) {
dns_message_currentname(msg, DNS_SECTION_AUTHORITY, &name);
dns_rdataset_t *rds = NULL;
ISC_LIST_FOREACH (name->list, rds, link) {
ISC_LIST_FOREACH(name->list, rds, link) {
if ((rds->attributes & DNS_RDATASETATTR_RENDERED) == 0)
{
continue;

View File

@@ -174,7 +174,7 @@ requests_cancel(void *arg) {
dns_request_t *request = NULL, *next = NULL;
uint32_t tid = isc_tid();
ISC_LIST_FOREACH_SAFE (requestmgr->requests[tid], request, link, next) {
ISC_LIST_FOREACH_SAFE(requestmgr->requests[tid], request, link, next) {
req_log(ISC_LOG_DEBUG(3), "%s(%" PRIu32 ": request %p",
__func__, tid, request);
if (DNS_REQUEST_COMPLETE(request)) {

View File

@@ -291,7 +291,7 @@ destroy_httpdmgr(isc_httpdmgr_t *httpdmgr) {
* memory.
*/
isc_httpdurl_t *url, *next;
ISC_LIST_FOREACH_SAFE (httpdmgr->urls, url, link, next) {
ISC_LIST_FOREACH_SAFE(httpdmgr->urls, url, link, next) {
isc_mem_free(httpdmgr->mctx, url->url);
ISC_LIST_UNLINK(httpdmgr->urls, url, link);
isc_mem_put(httpdmgr->mctx, url, sizeof(isc_httpdurl_t));
@@ -781,7 +781,7 @@ prepare_response(void *arg) {
}
LOCK(&mgr->lock);
ISC_LIST_FOREACH (mgr->urls, url, link) {
ISC_LIST_FOREACH(mgr->urls, url, link) {
if (strncmp(path, url->url, path_len) == 0) {
break;
}
@@ -980,7 +980,7 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) {
LOCK(&httpdmgr->lock);
isc_httpd_t *httpd = NULL, *next = NULL;
ISC_LIST_FOREACH_SAFE (httpdmgr->running, httpd, link, next) {
ISC_LIST_FOREACH_SAFE(httpdmgr->running, httpd, link, next) {
if (httpd->handle != NULL) {
httpd_request(httpd->handle, ISC_R_SUCCESS, NULL,
httpd);

View File

@@ -87,8 +87,9 @@ sched_affinity_ncpus(void) {
int i, n = 0;
for (i = 0; i < CPU_SETSIZE; ++i) {
if (CPU_ISSET(i, &cpus))
if (CPU_ISSET(i, &cpus)) {
++n;
}
}
return n;
#endif
@@ -115,8 +116,9 @@ cpuset_affinity_ncpus(void) {
if (result != -1) {
int i, n = 0;
for (i = 0; i < CPU_SETSIZE; ++i) {
if (CPU_ISSET(i, &cpus))
if (CPU_ISSET(i, &cpus)) {
++n;
}
}
return n;
}