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,11 +11,10 @@
#if HAVE_CMOCKA
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -29,30 +28,24 @@
/* test isc_netaddr_isnetzero() */
static void
netaddr_isnetzero(void **state) {
unsigned int i;
netaddr_isnetzero(void **state)
{
unsigned int i;
struct in_addr ina;
struct {
const char *address;
bool expect;
} tests[] = {
{ "0.0.0.0", true },
{ "0.0.0.1", true },
{ "0.0.1.2", true },
{ "0.1.2.3", true },
{ "10.0.0.0", false },
{ "10.9.0.0", false },
{ "10.9.8.0", false },
{ "10.9.8.7", false },
{ "127.0.0.0", false },
{ "127.0.0.1", false }
};
bool result;
bool expect;
} tests[] = { { "0.0.0.0", true }, { "0.0.0.1", true },
{ "0.0.1.2", true }, { "0.1.2.3", true },
{ "10.0.0.0", false }, { "10.9.0.0", false },
{ "10.9.8.0", false }, { "10.9.8.7", false },
{ "127.0.0.0", false }, { "127.0.0.1", false } };
bool result;
isc_netaddr_t netaddr;
UNUSED(state);
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
ina.s_addr = inet_addr(tests[i].address);
isc_netaddr_fromin(&netaddr, &ina);
result = isc_netaddr_isnetzero(&netaddr);
@@ -62,16 +55,17 @@ netaddr_isnetzero(void **state) {
/* test isc_netaddr_masktoprefixlen() calculates correct prefix lengths */
static void
netaddr_masktoprefixlen(void **state) {
netaddr_masktoprefixlen(void **state)
{
struct in_addr na_a;
struct in_addr na_b;
struct in_addr na_c;
struct in_addr na_d;
isc_netaddr_t ina_a;
isc_netaddr_t ina_b;
isc_netaddr_t ina_c;
isc_netaddr_t ina_d;
unsigned int plen;
isc_netaddr_t ina_a;
isc_netaddr_t ina_b;
isc_netaddr_t ina_c;
isc_netaddr_t ina_d;
unsigned int plen;
UNUSED(state);
@@ -90,7 +84,7 @@ netaddr_masktoprefixlen(void **state) {
assert_int_equal(plen, 0);
assert_int_equal(isc_netaddr_masktoprefixlen(&ina_b, &plen),
ISC_R_SUCCESS);
ISC_R_SUCCESS);
assert_int_equal(plen, 31);
assert_int_equal(isc_netaddr_masktoprefixlen(&ina_c, &plen),
@@ -104,28 +98,26 @@ netaddr_masktoprefixlen(void **state) {
/* check multicast addresses are detected properly */
static void
netaddr_multicast(void **state) {
netaddr_multicast(void **state)
{
unsigned int i;
struct {
int family;
int family;
const char *addr;
bool is_multicast;
bool is_multicast;
} tests[] = {
{ AF_INET, "1.2.3.4", false },
{ AF_INET, "4.3.2.1", false },
{ AF_INET, "224.1.1.1", true },
{ AF_INET, "1.1.1.244", false },
{ AF_INET6, "::1", false },
{ AF_INET6, "ff02::1", true }
{ AF_INET, "1.2.3.4", false }, { AF_INET, "4.3.2.1", false },
{ AF_INET, "224.1.1.1", true }, { AF_INET, "1.1.1.244", false },
{ AF_INET6, "::1", false }, { AF_INET6, "ff02::1", true }
};
UNUSED(state);
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
isc_netaddr_t na;
struct in_addr in;
isc_netaddr_t na;
struct in_addr in;
struct in6_addr in6;
int r;
int r;
if (tests[i].family == AF_INET) {
r = inet_pton(AF_INET, tests[i].addr,
@@ -145,7 +137,8 @@ netaddr_multicast(void **state) {
}
int
main(void) {
main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(netaddr_isnetzero),
cmocka_unit_test(netaddr_masktoprefixlen),
@@ -160,7 +153,8 @@ main(void) {
#include <stdio.h>
int
main(void) {
main(void)
{
printf("1..0 # Skipped: cmocka not available\n");
return (0);
}