Add couple missing braces around single-line statements

The clang-format-15 has new option InsertBraces that could add missing
branches around single line statements.  Use that to our advantage
without switching to not-yet-released LLVM version to add missing braces
in couple of places.
This commit is contained in:
Ondřej Surý
2022-03-13 13:05:27 +01:00
parent 8495edc31d
commit ff22498849
10 changed files with 33 additions and 16 deletions

View File

@@ -394,8 +394,9 @@ openssleddsa_todns(const dst_key_t *key, isc_buffer_t *data) {
return (ISC_R_NOSPACE);
}
if (EVP_PKEY_get_raw_public_key(pkey, r.base, &len) != 1)
if (EVP_PKEY_get_raw_public_key(pkey, r.base, &len) != 1) {
return (dst__openssl_toresult(ISC_R_FAILURE));
}
isc_buffer_add(data, len);
return (ISC_R_SUCCESS);
@@ -418,8 +419,9 @@ openssleddsa_fromdns(dst_key_t *key, isc_buffer_t *data) {
len = r.length;
ret = raw_key_to_ossl(key->key_alg, 0, r.base, &len, &pkey);
if (ret != ISC_R_SUCCESS)
if (ret != ISC_R_SUCCESS) {
return ret;
}
isc_buffer_forward(data, len);
key->keydata.pkey = pkey;
@@ -457,8 +459,9 @@ openssleddsa_tofile(const dst_key_t *key, const char *directory) {
}
buf = isc_mem_get(key->mctx, len);
if (EVP_PKEY_get_raw_private_key(key->keydata.pkey, buf,
&len) != 1)
&len) != 1) {
DST_RET(dst__openssl_toresult(ISC_R_FAILURE));
}
priv.elements[i].tag = TAG_EDDSA_PRIVATEKEY;
priv.elements[i].length = len;
priv.elements[i].data = buf;

View File

@@ -72,8 +72,9 @@ fromwire_gpos(ARGS_FROMWIRE) {
UNUSED(rdclass);
UNUSED(options);
for (i = 0; i < 3; i++)
for (i = 0; i < 3; i++) {
RETERR(txt_fromwire(source, target));
}
return (ISC_R_SUCCESS);
}

View File

@@ -290,7 +290,9 @@ fromstruct_hip(ARGS_FROMSTRUCT) {
myhip = *hip;
for (result = dns_rdata_hip_first(&myhip); result == ISC_R_SUCCESS;
result = dns_rdata_hip_next(&myhip))
/* empty */;
{
/* initialize the names */
}
return (mem_tobuffer(target, hip->servers, hip->servers_len));
}

View File

@@ -473,8 +473,9 @@ mem_thread(isc_threadarg_t arg) {
isc_mem_t *mctx = (isc_mem_t *)arg;
void *items[NUM_ITEMS];
size_t size = atomic_load(&mem_size);
while (!atomic_compare_exchange_weak(&mem_size, &size, size / 2))
while (!atomic_compare_exchange_weak(&mem_size, &size, size / 2)) {
;
}
for (int i = 0; i < ITERS; i++) {
for (int j = 0; j < NUM_ITEMS; j++) {