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

Use clang-tidy to add curly braces around one-line statements

The command used to reformat the files in this commit was:

./util/run-clang-tidy \
	-clang-tidy-binary clang-tidy-11
	-clang-apply-replacements-binary clang-apply-replacements-11 \
	-checks=-*,readability-braces-around-statements \
	-j 9 \
	-fix \
	-format \
	-style=file \
	-quiet
clang-format -i --style=format $(git ls-files '*.c' '*.h')
uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h')
clang-format -i --style=format $(git ls-files '*.c' '*.h')
This commit is contained in:
Ondřej Surý
2020-02-13 21:48:23 +01:00
parent d14bb71319
commit 056e133c4c
637 changed files with 28926 additions and 16901 deletions

View File

@@ -24,7 +24,7 @@
do { \
isc_result_t _r = (x); \
if (_r != ISC_R_SUCCESS) \
return (_r); \
return ((_r)); \
} while (0)
/*
@@ -45,8 +45,9 @@ isc_hex_totext(isc_region_t *source, int wordlength, const char *wordbreak,
char buf[3];
unsigned int loops = 0;
if (wordlength < 2)
if (wordlength < 2) {
wordlength = 2;
}
memset(buf, 0, sizeof(buf));
while (source->length > 0) {
@@ -88,8 +89,9 @@ hex_decode_char(hex_decode_ctx_t *ctx, int c)
{
const char *s;
if ((s = strchr(hex, toupper(c))) == NULL)
if ((s = strchr(hex, toupper(c))) == NULL) {
return (ISC_R_BADHEX);
}
ctx->val[ctx->digits++] = (int)(s - hex);
if (ctx->digits == 2) {
unsigned char num;
@@ -97,10 +99,11 @@ hex_decode_char(hex_decode_ctx_t *ctx, int c)
num = (ctx->val[0] << 4) + (ctx->val[1]);
RETERR(mem_tobuffer(ctx->target, &num, 1));
if (ctx->length >= 0) {
if (ctx->length == 0)
if (ctx->length == 0) {
return (ISC_R_BADHEX);
else
} else {
ctx->length -= 1;
}
}
ctx->digits = 0;
}
@@ -110,10 +113,12 @@ hex_decode_char(hex_decode_ctx_t *ctx, int c)
static inline isc_result_t
hex_decode_finish(hex_decode_ctx_t *ctx)
{
if (ctx->length > 0)
if (ctx->length > 0) {
return (ISC_R_UNEXPECTEDEND);
if (ctx->digits != 0)
}
if (ctx->digits != 0) {
return (ISC_R_BADHEX);
}
return (ISC_R_SUCCESS);
}
@@ -168,10 +173,12 @@ isc_hex_decodestring(const char *cstr, isc_buffer_t *target)
hex_decode_init(&ctx, -1, target);
for (;;) {
int c = *cstr++;
if (c == '\0')
if (c == '\0') {
break;
if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
}
if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
continue;
}
RETERR(hex_decode_char(&ctx, c));
}
RETERR(hex_decode_finish(&ctx));
@@ -187,8 +194,9 @@ str_totext(const char *source, isc_buffer_t *target)
isc_buffer_availableregion(target, &region);
l = strlen(source);
if (l > region.length)
if (l > region.length) {
return (ISC_R_NOSPACE);
}
memmove(region.base, source, l);
isc_buffer_add(target, l);
@@ -201,8 +209,9 @@ mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length)
isc_region_t tr;
isc_buffer_availableregion(target, &tr);
if (length > tr.length)
if (length > tr.length) {
return (ISC_R_NOSPACE);
}
memmove(tr.base, base, length);
isc_buffer_add(target, length);
return (ISC_R_SUCCESS);