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

@@ -62,8 +62,9 @@ isc_symtab_create(isc_mem_t *mctx, unsigned int size,
symtab->mctx = NULL;
isc_mem_attach(mctx, &symtab->mctx);
symtab->table = isc_mem_get(mctx, size * sizeof(eltlist_t));
for (i = 0; i < size; i++)
for (i = 0; i < size; i++) {
INIT_LIST(symtab->table[i]);
}
symtab->size = size;
symtab->count = 0;
symtab->maxload = size * 3 / 4;
@@ -92,10 +93,11 @@ isc_symtab_destroy(isc_symtab_t **symtabp)
for (i = 0; i < symtab->size; i++) {
for (elt = HEAD(symtab->table[i]); elt != NULL; elt = nelt) {
nelt = NEXT(elt, link);
if (symtab->undefine_action != NULL)
if (symtab->undefine_action != NULL) {
(symtab->undefine_action)(elt->key, elt->type,
elt->value,
symtab->undefine_arg);
}
isc_mem_put(symtab->mctx, elt, sizeof(*elt));
}
}
@@ -160,11 +162,13 @@ isc_symtab_lookup(isc_symtab_t *symtab, const char *key, unsigned int type,
FIND(symtab, key, type, bucket, elt);
if (elt == NULL)
if (elt == NULL) {
return (ISC_R_NOTFOUND);
}
if (value != NULL)
if (value != NULL) {
*value = elt->value;
}
return (ISC_R_SUCCESS);
}
@@ -183,8 +187,9 @@ grow_table(isc_symtab_t *symtab)
newtable = isc_mem_get(symtab->mctx, newsize * sizeof(eltlist_t));
for (i = 0; i < newsize; i++)
for (i = 0; i < newsize; i++) {
INIT_LIST(newtable[i]);
}
for (i = 0; i < symtab->size; i++) {
elt_t *elt, *nelt;
@@ -222,14 +227,16 @@ isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type,
FIND(symtab, key, type, bucket, elt);
if (exists_policy != isc_symexists_add && elt != NULL) {
if (exists_policy == isc_symexists_reject)
if (exists_policy == isc_symexists_reject) {
return (ISC_R_EXISTS);
}
INSIST(exists_policy == isc_symexists_replace);
UNLINK(symtab->table[bucket], elt, link);
if (symtab->undefine_action != NULL)
if (symtab->undefine_action != NULL) {
(symtab->undefine_action)(elt->key, elt->type,
elt->value,
symtab->undefine_arg);
}
} else {
elt = isc_mem_get(symtab->mctx, sizeof(*elt));
ISC_LINK_INIT(elt, link);
@@ -252,8 +259,9 @@ isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type,
*/
PREPEND(symtab->table[bucket], elt, link);
if (symtab->count > symtab->maxload)
if (symtab->count > symtab->maxload) {
grow_table(symtab);
}
return (ISC_R_SUCCESS);
}
@@ -269,12 +277,14 @@ isc_symtab_undefine(isc_symtab_t *symtab, const char *key, unsigned int type)
FIND(symtab, key, type, bucket, elt);
if (elt == NULL)
if (elt == NULL) {
return (ISC_R_NOTFOUND);
}
if (symtab->undefine_action != NULL)
if (symtab->undefine_action != NULL) {
(symtab->undefine_action)(elt->key, elt->type, elt->value,
symtab->undefine_arg);
}
UNLINK(symtab->table[bucket], elt, link);
isc_mem_put(symtab->mctx, elt, sizeof(*elt));
symtab->count--;