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 commit7099e79a9b)4c3b063eImport Linux kernel .clang-format with small modificationsf50b1e06Use clang-format to reformat the source files11341c76Update the definition files for Windowsdf6c1f76Remove tkey_test (which is no-op anyway)
This commit is contained in:
@@ -11,13 +11,12 @@
|
||||
|
||||
#if HAVE_CMOCKA
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <inttypes.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>
|
||||
@@ -43,7 +42,8 @@ dns_dispatchmgr_t *dispatchmgr = NULL;
|
||||
dns_dispatchset_t *dset = NULL;
|
||||
|
||||
static int
|
||||
_setup(void **state) {
|
||||
_setup(void **state)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -55,7 +55,8 @@ _setup(void **state) {
|
||||
}
|
||||
|
||||
static int
|
||||
_teardown(void **state) {
|
||||
_teardown(void **state)
|
||||
{
|
||||
UNUSED(state);
|
||||
|
||||
dns_test_end();
|
||||
@@ -64,10 +65,11 @@ _teardown(void **state) {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
make_dispatchset(unsigned int ndisps) {
|
||||
isc_result_t result;
|
||||
isc_sockaddr_t any;
|
||||
unsigned int attrs;
|
||||
make_dispatchset(unsigned int ndisps)
|
||||
{
|
||||
isc_result_t result;
|
||||
isc_sockaddr_t any;
|
||||
unsigned int attrs;
|
||||
dns_dispatch_t *disp = NULL;
|
||||
|
||||
result = dns_dispatchmgr_create(dt_mctx, &dispatchmgr);
|
||||
@@ -76,9 +78,8 @@ make_dispatchset(unsigned int ndisps) {
|
||||
|
||||
isc_sockaddr_any(&any);
|
||||
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
|
||||
result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr,
|
||||
&any, 512, 6, 1024, 17, 19, attrs,
|
||||
attrs, &disp);
|
||||
result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, &any, 512,
|
||||
6, 1024, 17, 19, attrs, attrs, &disp);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
@@ -90,7 +91,8 @@ make_dispatchset(unsigned int ndisps) {
|
||||
}
|
||||
|
||||
static void
|
||||
reset(void) {
|
||||
reset(void)
|
||||
{
|
||||
if (dset != NULL) {
|
||||
dns_dispatchset_destroy(&dset);
|
||||
}
|
||||
@@ -101,7 +103,8 @@ reset(void) {
|
||||
|
||||
/* create dispatch set */
|
||||
static void
|
||||
dispatchset_create(void **state) {
|
||||
dispatchset_create(void **state)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -117,8 +120,9 @@ dispatchset_create(void **state) {
|
||||
|
||||
/* test dispatch set round-robin */
|
||||
static void
|
||||
dispatchset_get(void **state) {
|
||||
isc_result_t result;
|
||||
dispatchset_get(void **state)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_dispatch_t *d1, *d2, *d3, *d4, *d5;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -158,7 +162,8 @@ dispatchset_get(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
senddone(isc_task_t *task, isc_event_t *event) {
|
||||
senddone(isc_task_t *task, isc_event_t *event)
|
||||
{
|
||||
isc_socket_t *sock = event->ev_arg;
|
||||
|
||||
UNUSED(task);
|
||||
@@ -168,22 +173,23 @@ senddone(isc_task_t *task, isc_event_t *event) {
|
||||
}
|
||||
|
||||
static void
|
||||
nameserver(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
isc_region_t region;
|
||||
isc_socket_t *dummy;
|
||||
isc_socket_t *sock = event->ev_arg;
|
||||
isc_socketevent_t *ev = (isc_socketevent_t *)event;
|
||||
nameserver(isc_task_t *task, isc_event_t *event)
|
||||
{
|
||||
isc_result_t result;
|
||||
isc_region_t region;
|
||||
isc_socket_t * dummy;
|
||||
isc_socket_t * sock = event->ev_arg;
|
||||
isc_socketevent_t * ev = (isc_socketevent_t *)event;
|
||||
static unsigned char buf1[16];
|
||||
static unsigned char buf2[16];
|
||||
|
||||
memmove(buf1, ev->region.base, 12);
|
||||
memset(buf1 + 12, 0, 4);
|
||||
buf1[2] |= 0x80; /* qr=1 */
|
||||
buf1[2] |= 0x80; /* qr=1 */
|
||||
|
||||
memmove(buf2, ev->region.base, 12);
|
||||
memset(buf2 + 12, 1, 4);
|
||||
buf2[2] |= 0x80; /* qr=1 */
|
||||
buf2[2] |= 0x80; /* qr=1 */
|
||||
|
||||
/*
|
||||
* send message to be discarded.
|
||||
@@ -211,16 +217,17 @@ nameserver(isc_task_t *task, isc_event_t *event) {
|
||||
isc_event_free(&event);
|
||||
}
|
||||
|
||||
static dns_dispatch_t *dispatch = NULL;
|
||||
static dns_dispentry_t *dispentry = NULL;
|
||||
static atomic_bool first = ATOMIC_VAR_INIT(true);
|
||||
static isc_sockaddr_t local;
|
||||
static dns_dispatch_t * dispatch = NULL;
|
||||
static dns_dispentry_t * dispentry = NULL;
|
||||
static atomic_bool first = ATOMIC_VAR_INIT(true);
|
||||
static isc_sockaddr_t local;
|
||||
static atomic_uint_fast32_t responses;
|
||||
|
||||
static void
|
||||
response(isc_task_t *task, isc_event_t *event) {
|
||||
response(isc_task_t *task, isc_event_t *event)
|
||||
{
|
||||
dns_dispatchevent_t *devent = (dns_dispatchevent_t *)event;
|
||||
bool exp_true = true;
|
||||
bool exp_true = true;
|
||||
|
||||
UNUSED(task);
|
||||
|
||||
@@ -235,8 +242,9 @@ response(isc_task_t *task, isc_event_t *event) {
|
||||
}
|
||||
|
||||
static void
|
||||
startit(isc_task_t *task, isc_event_t *event) {
|
||||
isc_result_t result;
|
||||
startit(isc_task_t *task, isc_event_t *event)
|
||||
{
|
||||
isc_result_t result;
|
||||
isc_socket_t *sock = NULL;
|
||||
|
||||
isc_socket_attach(dns_dispatch_getsocket(dispatch), &sock);
|
||||
@@ -248,16 +256,17 @@ startit(isc_task_t *task, isc_event_t *event) {
|
||||
|
||||
/* test dispatch getnext */
|
||||
static void
|
||||
dispatch_getnext(void **state) {
|
||||
isc_region_t region;
|
||||
isc_result_t result;
|
||||
isc_socket_t *sock = NULL;
|
||||
isc_task_t *task = NULL;
|
||||
uint16_t id;
|
||||
dispatch_getnext(void **state)
|
||||
{
|
||||
isc_region_t region;
|
||||
isc_result_t result;
|
||||
isc_socket_t * sock = NULL;
|
||||
isc_task_t * task = NULL;
|
||||
uint16_t id;
|
||||
struct in_addr ina;
|
||||
unsigned char message[12];
|
||||
unsigned int attrs;
|
||||
unsigned char rbuf[12];
|
||||
unsigned char message[12];
|
||||
unsigned int attrs;
|
||||
unsigned char rbuf[12];
|
||||
|
||||
UNUSED(state);
|
||||
|
||||
@@ -272,9 +281,9 @@ dispatch_getnext(void **state) {
|
||||
ina.s_addr = htonl(INADDR_LOOPBACK);
|
||||
isc_sockaddr_fromin(&local, &ina, 0);
|
||||
attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP;
|
||||
result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr,
|
||||
&local, 512, 6, 1024, 17, 19, attrs,
|
||||
attrs, &dispatch);
|
||||
result = dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, &local,
|
||||
512, 6, 1024, 17, 19, attrs, attrs,
|
||||
&dispatch);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
|
||||
/*
|
||||
@@ -330,14 +339,15 @@ dispatch_getnext(void **state) {
|
||||
}
|
||||
|
||||
int
|
||||
main(void) {
|
||||
main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(dispatchset_create,
|
||||
_setup, _teardown),
|
||||
cmocka_unit_test_setup_teardown(dispatchset_get,
|
||||
_setup, _teardown),
|
||||
cmocka_unit_test_setup_teardown(dispatch_getnext,
|
||||
_setup, _teardown),
|
||||
cmocka_unit_test_setup_teardown(dispatchset_create, _setup,
|
||||
_teardown),
|
||||
cmocka_unit_test_setup_teardown(dispatchset_get, _setup,
|
||||
_teardown),
|
||||
cmocka_unit_test_setup_teardown(dispatch_getnext, _setup,
|
||||
_teardown),
|
||||
};
|
||||
|
||||
return (cmocka_run_group_tests(tests, NULL, NULL));
|
||||
@@ -348,7 +358,8 @@ main(void) {
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void) {
|
||||
main(void)
|
||||
{
|
||||
printf("1..0 # Skipped: cmocka not available\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user