Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'

Reformat source code with clang-format

Closes #46

See merge request isc-projects/bind9!2156

(cherry picked from commit 7099e79a9b)

4c3b063e Import Linux kernel .clang-format with small modifications
f50b1e06 Use clang-format to reformat the source files
11341c76 Update the definition files for Windows
df6c1f76 Remove tkey_test (which is no-op anyway)
This commit is contained in:
Ondřej Surý
2020-02-12 14:33:32 +00:00
parent dbe15330fe
commit c931d8e417
974 changed files with 75952 additions and 74434 deletions

View File

@@ -11,14 +11,13 @@
#if HAVE_CMOCKA
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <fcntl.h>
#include <limits.h>
#include <sched.h> /* IWYU pragma: keep */
#include <setjmp.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -36,7 +35,8 @@
#include "isctest.h"
static int
_setup(void **state) {
_setup(void **state)
{
isc_result_t result;
UNUSED(state);
@@ -48,7 +48,8 @@ _setup(void **state) {
}
static int
_teardown(void **state) {
_teardown(void **state)
{
UNUSED(state);
isc_test_end();
@@ -58,8 +59,9 @@ _teardown(void **state) {
/* reserve space in dynamic buffers */
static void
isc_buffer_reserve_test(void **state) {
isc_result_t result;
isc_buffer_reserve_test(void **state)
{
isc_result_t result;
isc_buffer_t *b;
UNUSED(state);
@@ -125,10 +127,11 @@ isc_buffer_reserve_test(void **state) {
/* dynamic buffer automatic reallocation */
static void
isc_buffer_dynamic_test(void **state) {
isc_buffer_dynamic_test(void **state)
{
isc_buffer_t *b;
size_t last_length = 10;
int i;
size_t last_length = 10;
int i;
UNUSED(state);
@@ -144,45 +147,45 @@ isc_buffer_dynamic_test(void **state) {
for (i = 0; i < 1000; i++) {
isc_buffer_putstr(b, "thisisa24charslongstring");
}
assert_true(b->length-last_length >= 1000*24);
last_length+=1000*24;
assert_true(b->length - last_length >= 1000 * 24);
last_length += 1000 * 24;
for (i = 0; i < 10000; i++) {
isc_buffer_putuint8(b, 1);
}
assert_true(b->length-last_length >= 10000*1);
last_length += 10000*1;
assert_true(b->length - last_length >= 10000 * 1);
last_length += 10000 * 1;
for (i = 0; i < 10000; i++) {
isc_buffer_putuint16(b, 1);
}
assert_true(b->length-last_length >= 10000*2);
assert_true(b->length - last_length >= 10000 * 2);
last_length += 10000*2;
last_length += 10000 * 2;
for (i = 0; i < 10000; i++) {
isc_buffer_putuint24(b, 1);
}
assert_true(b->length-last_length >= 10000*3);
assert_true(b->length - last_length >= 10000 * 3);
last_length+=10000*3;
last_length += 10000 * 3;
for (i = 0; i < 10000; i++) {
isc_buffer_putuint32(b, 1);
}
assert_true(b->length-last_length >= 10000*4);
assert_true(b->length - last_length >= 10000 * 4);
isc_buffer_free(&b);
}
/* copy a region into a buffer */
static void
isc_buffer_copyregion_test(void **state) {
isc_buffer_copyregion_test(void **state)
{
unsigned char data[] = { 0x11, 0x22, 0x33, 0x44 };
isc_buffer_t *b = NULL;
isc_result_t result;
isc_result_t result;
isc_region_t r = {
.base = data,
@@ -217,12 +220,13 @@ isc_buffer_copyregion_test(void **state) {
/* sprintf() into a buffer */
static void
isc_buffer_printf_test(void **state) {
unsigned int used, prev_used;
const char *empty_fmt;
isc_result_t result;
isc_buffer_printf_test(void **state)
{
unsigned int used, prev_used;
const char * empty_fmt;
isc_result_t result;
isc_buffer_t *b, sb;
char buf[8];
char buf[8];
UNUSED(state);
@@ -323,16 +327,17 @@ isc_buffer_printf_test(void **state) {
}
int
main(void) {
main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test_setup_teardown(isc_buffer_reserve_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(isc_buffer_dynamic_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(isc_buffer_reserve_test, _setup,
_teardown),
cmocka_unit_test_setup_teardown(isc_buffer_dynamic_test, _setup,
_teardown),
cmocka_unit_test_setup_teardown(isc_buffer_copyregion_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(isc_buffer_printf_test,
_setup, _teardown),
cmocka_unit_test_setup_teardown(isc_buffer_printf_test, _setup,
_teardown),
};
return (cmocka_run_group_tests(tests, NULL, NULL));
@@ -343,7 +348,8 @@ main(void) {
#include <stdio.h>
int
main(void) {
main(void)
{
printf("1..0 # Skipped: cmocka not available\n");
return (0);
}