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 <errno.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -27,75 +26,74 @@
#include <isc/util.h>
typedef struct {
int err;
int err;
isc_result_t result;
} testpair_t;
testpair_t testpair[] = {
{ EPERM, ISC_R_NOPERM },
{ ENOENT, ISC_R_FILENOTFOUND },
{ EIO, ISC_R_IOERROR },
{ EBADF, ISC_R_INVALIDFILE },
{ ENOMEM, ISC_R_NOMEMORY },
{ EACCES, ISC_R_NOPERM },
{ EEXIST, ISC_R_FILEEXISTS },
{ ENOTDIR, ISC_R_INVALIDFILE },
{ EINVAL, ISC_R_INVALIDFILE },
{ ENFILE, ISC_R_TOOMANYOPENFILES },
{ EMFILE, ISC_R_TOOMANYOPENFILES },
{ EPIPE, ISC_R_CONNECTIONRESET },
{ ENAMETOOLONG, ISC_R_INVALIDFILE },
{ ELOOP, ISC_R_INVALIDFILE },
testpair_t testpair[] = { { EPERM, ISC_R_NOPERM },
{ ENOENT, ISC_R_FILENOTFOUND },
{ EIO, ISC_R_IOERROR },
{ EBADF, ISC_R_INVALIDFILE },
{ ENOMEM, ISC_R_NOMEMORY },
{ EACCES, ISC_R_NOPERM },
{ EEXIST, ISC_R_FILEEXISTS },
{ ENOTDIR, ISC_R_INVALIDFILE },
{ EINVAL, ISC_R_INVALIDFILE },
{ ENFILE, ISC_R_TOOMANYOPENFILES },
{ EMFILE, ISC_R_TOOMANYOPENFILES },
{ EPIPE, ISC_R_CONNECTIONRESET },
{ ENAMETOOLONG, ISC_R_INVALIDFILE },
{ ELOOP, ISC_R_INVALIDFILE },
#ifdef EOVERFLOW
{ EOVERFLOW, ISC_R_RANGE },
{ EOVERFLOW, ISC_R_RANGE },
#endif
#ifdef EAFNOSUPPORT
{ EAFNOSUPPORT, ISC_R_FAMILYNOSUPPORT },
{ EAFNOSUPPORT, ISC_R_FAMILYNOSUPPORT },
#endif
#ifdef EADDRINUSE
{ EADDRINUSE, ISC_R_ADDRINUSE },
{ EADDRINUSE, ISC_R_ADDRINUSE },
#endif
{ EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL },
{ EADDRNOTAVAIL, ISC_R_ADDRNOTAVAIL },
#ifdef ENETDOWN
{ ENETDOWN, ISC_R_NETDOWN },
{ ENETDOWN, ISC_R_NETDOWN },
#endif
#ifdef ENETUNREACH
{ ENETUNREACH, ISC_R_NETUNREACH },
{ ENETUNREACH, ISC_R_NETUNREACH },
#endif
#ifdef ECONNABORTED
{ ECONNABORTED, ISC_R_CONNECTIONRESET },
{ ECONNABORTED, ISC_R_CONNECTIONRESET },
#endif
#ifdef ECONNRESET
{ ECONNRESET, ISC_R_CONNECTIONRESET },
{ ECONNRESET, ISC_R_CONNECTIONRESET },
#endif
#ifdef ENOBUFS
{ ENOBUFS, ISC_R_NORESOURCES },
{ ENOBUFS, ISC_R_NORESOURCES },
#endif
#ifdef ENOTCONN
{ ENOTCONN, ISC_R_NOTCONNECTED },
{ ENOTCONN, ISC_R_NOTCONNECTED },
#endif
#ifdef ETIMEDOUT
{ ETIMEDOUT, ISC_R_TIMEDOUT },
{ ETIMEDOUT, ISC_R_TIMEDOUT },
#endif
{ ECONNREFUSED, ISC_R_CONNREFUSED },
{ ECONNREFUSED, ISC_R_CONNREFUSED },
#ifdef EHOSTDOWN
{ EHOSTDOWN, ISC_R_HOSTDOWN },
{ EHOSTDOWN, ISC_R_HOSTDOWN },
#endif
#ifdef EHOSTUNREACH
{ EHOSTUNREACH, ISC_R_HOSTUNREACH },
{ EHOSTUNREACH, ISC_R_HOSTUNREACH },
#endif
{ 0, ISC_R_UNEXPECTED }
};
{ 0, ISC_R_UNEXPECTED } };
/* convert errno to ISC result */
static void
isc_errno_toresult_test(void **state) {
isc_errno_toresult_test(void **state)
{
isc_result_t result, expect;
size_t i;
size_t i;
UNUSED(state);
for (i = 0; i < sizeof(testpair)/sizeof(testpair[0]); i++) {
for (i = 0; i < sizeof(testpair) / sizeof(testpair[0]); i++) {
result = isc_errno_toresult(testpair[i].err);
expect = testpair[i].result;
assert_int_equal(result, expect);
@@ -103,7 +101,8 @@ isc_errno_toresult_test(void **state) {
}
int
main(void) {
main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test(isc_errno_toresult_test),
};
@@ -116,7 +115,8 @@ main(void) {
#include <stdio.h>
int
main(void) {
main(void)
{
printf("1..0 # Skipped: cmocka not available\n");
return (0);
}