mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
[9.20] chg: dev: Update clang-format style with options added in newer versions
Add and apply InsertBraces statement to add missing curly braces around one-line statements and use ControlStatementsExceptControlMacros for SpaceBeforeParens to remove space between foreach macro and the brace, e.g. `FOREACH (x) {` becomes `FOREACH(x) {`. Backport of MR !10863 Merge branch 'backport-ondrej/update-clang-format-9.20' into 'bind-9.20' See merge request isc-projects/bind9!10864
This commit is contained in:
@@ -69,6 +69,7 @@ IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 0
|
||||
IndentExternBlock: NoIndent
|
||||
InsertBraces: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
@@ -81,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
|
||||
|
@@ -69,6 +69,7 @@ IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 0
|
||||
IndentExternBlock: NoIndent
|
||||
InsertBraces: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
PenaltyBreakAssignment: 30
|
||||
@@ -80,3 +81,4 @@ Standard: Cpp11
|
||||
ContinuationIndentWidth: 8
|
||||
RemoveParentheses: ReturnStatement
|
||||
RemoveSemicolon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
|
@@ -1550,3 +1550,7 @@ c22176c0f9a71217be9bfab00573f8f0265499af
|
||||
58a15d38c2c321fac75abef389a48ff82deaccf0
|
||||
# Reformat sources with up-to-date clang-format-20
|
||||
53738b0e5e0037b7ac8d06e146832d972e2e46d5
|
||||
# Add and apply InsertBraces statement
|
||||
58791b5cfe8d6d17e05a450fb9cf72cc52472541
|
||||
# Use ControlStatementsExceptControlMacros for SpaceBeforeParens
|
||||
8f8fb10232eabcee1d78efb52623a07d6326cdb6
|
||||
|
@@ -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));
|
||||
|
@@ -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;
|
||||
|
@@ -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)) {
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -752,7 +752,9 @@ Exit:
|
||||
if (decoder->_total_overhead >= 100 * 1024 &&
|
||||
decoder->_total_read - decoder->_total_overhead <
|
||||
decoder->_total_read / 4)
|
||||
{
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user