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,11 +11,10 @@
|
||||
|
||||
#if HAVE_CMOCKA
|
||||
|
||||
#include <sched.h> /* IWYU pragma: keep */
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <sched.h> /* IWYU pragma: keep */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -35,29 +34,28 @@
|
||||
#include <isccfg/grammar.h>
|
||||
#include <isccfg/namedconf.h>
|
||||
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
#define CHECK(r) \
|
||||
do { \
|
||||
result = (r); \
|
||||
if (result != ISC_R_SUCCESS) \
|
||||
goto cleanup; \
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
isc_mem_t *mctx = NULL;
|
||||
isc_log_t *lctx = NULL;
|
||||
static isc_logcategory_t categories[] = {
|
||||
{ "", 0 },
|
||||
{ "client", 0 },
|
||||
{ "network", 0 },
|
||||
{ "update", 0 },
|
||||
{ "queries", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ "update-security", 0 },
|
||||
{ "query-errors", 0 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
isc_mem_t * mctx = NULL;
|
||||
isc_log_t * lctx = NULL;
|
||||
static isc_logcategory_t categories[] = { { "", 0 },
|
||||
{ "client", 0 },
|
||||
{ "network", 0 },
|
||||
{ "update", 0 },
|
||||
{ "queries", 0 },
|
||||
{ "unmatched", 0 },
|
||||
{ "update-security", 0 },
|
||||
{ "query-errors", 0 },
|
||||
{ NULL, 0 } };
|
||||
|
||||
static void
|
||||
cleanup() {
|
||||
cleanup()
|
||||
{
|
||||
if (lctx != NULL) {
|
||||
isc_log_destroy(&lctx);
|
||||
}
|
||||
@@ -67,14 +65,15 @@ cleanup() {
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
setup() {
|
||||
setup()
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
|
||||
isc_mem_create(&mctx);
|
||||
|
||||
isc_logdestination_t destination;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_logconfig_t * logconfig = NULL;
|
||||
|
||||
CHECK(isc_log_create(mctx, &lctx, &logconfig));
|
||||
isc_log_registercategories(lctx, categories);
|
||||
@@ -84,27 +83,26 @@ setup() {
|
||||
destination.file.name = NULL;
|
||||
destination.file.versions = ISC_LOG_ROLLNEVER;
|
||||
destination.file.maximum_size = 0;
|
||||
CHECK(isc_log_createchannel(logconfig, "stderr",
|
||||
ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC,
|
||||
&destination, 0));
|
||||
CHECK(isc_log_createchannel(logconfig, "stderr", ISC_LOG_TOFILEDESC,
|
||||
ISC_LOG_DYNAMIC, &destination, 0));
|
||||
CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL));
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
cleanup();
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* test cfg_parse_buffer() */
|
||||
static void
|
||||
parse_buffer_test(void **state) {
|
||||
isc_result_t result;
|
||||
parse_buffer_test(void **state)
|
||||
{
|
||||
isc_result_t result;
|
||||
unsigned char text[] = "options\n{\nrecursion yes;\n};\n";
|
||||
isc_buffer_t buf1, buf2;
|
||||
isc_buffer_t buf1, buf2;
|
||||
cfg_parser_t *p1 = NULL, *p2 = NULL;
|
||||
cfg_obj_t *c1 = NULL, *c2 = NULL;
|
||||
cfg_obj_t * c1 = NULL, *c2 = NULL;
|
||||
|
||||
UNUSED(state);
|
||||
|
||||
@@ -117,8 +115,8 @@ parse_buffer_test(void **state) {
|
||||
result = cfg_parser_create(mctx, lctx, &p1);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
|
||||
result = cfg_parse_buffer(p1, &buf1, "text1", 0,
|
||||
&cfg_type_namedconf, 0, &c1);
|
||||
result = cfg_parse_buffer(p1, &buf1, "text1", 0, &cfg_type_namedconf, 0,
|
||||
&c1);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
assert_int_equal(p1->line, 5);
|
||||
|
||||
@@ -129,8 +127,8 @@ parse_buffer_test(void **state) {
|
||||
result = cfg_parser_create(mctx, lctx, &p2);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
|
||||
result = cfg_parse_buffer(p2, &buf2, "text2", 100,
|
||||
&cfg_type_namedconf, 0, &c2);
|
||||
result = cfg_parse_buffer(p2, &buf2, "text2", 100, &cfg_type_namedconf,
|
||||
0, &c2);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
assert_int_equal(p2->line, 104);
|
||||
|
||||
@@ -145,9 +143,10 @@ parse_buffer_test(void **state) {
|
||||
|
||||
/* test cfg_map_firstclause() */
|
||||
static void
|
||||
cfg_map_firstclause_test(void **state) {
|
||||
const char *name = NULL;
|
||||
const void *clauses = NULL;
|
||||
cfg_map_firstclause_test(void **state)
|
||||
{
|
||||
const char * name = NULL;
|
||||
const void * clauses = NULL;
|
||||
unsigned int idx;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -160,9 +159,10 @@ cfg_map_firstclause_test(void **state) {
|
||||
|
||||
/* test cfg_map_nextclause() */
|
||||
static void
|
||||
cfg_map_nextclause_test(void **state) {
|
||||
const char *name = NULL;
|
||||
const void *clauses = NULL;
|
||||
cfg_map_nextclause_test(void **state)
|
||||
{
|
||||
const char * name = NULL;
|
||||
const void * clauses = NULL;
|
||||
unsigned int idx;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -184,7 +184,8 @@ cfg_map_nextclause_test(void **state) {
|
||||
}
|
||||
|
||||
int
|
||||
main(void) {
|
||||
main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(parse_buffer_test),
|
||||
cmocka_unit_test(cfg_map_firstclause_test),
|
||||
@@ -199,7 +200,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