Merge branch 'each-style-tweak' into 'master'

adjust clang-format options to get closer to ISC style

See merge request isc-projects/bind9!3061

(cherry picked from commit d3b49b6675)

0255a974 revise .clang-format and add a C formatting script in util
e851ed0b apply the modified style
This commit is contained in:
Ondřej Surý
2020-02-14 05:35:17 +00:00
parent c646c20e79
commit cdef20bb66
672 changed files with 36044 additions and 42228 deletions

View File

@@ -40,8 +40,7 @@
#include "dnstest.h"
static int
_setup(void **state)
{
_setup(void **state) {
isc_result_t result;
UNUSED(state);
@@ -53,8 +52,7 @@ _setup(void **state)
}
static int
_teardown(void **state)
{
_teardown(void **state) {
UNUSED(state);
dns_test_end();
@@ -63,32 +61,29 @@ _teardown(void **state)
}
static void
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...)
{
nullmsg(dns_rdatacallbacks_t *cb, const char *fmt, ...) {
UNUSED(cb);
UNUSED(fmt);
}
#define BUFLEN 255
#define BIGBUFLEN (70 * 1024)
#define BUFLEN 255
#define BIGBUFLEN (70 * 1024)
#define TEST_ORIGIN "test"
static dns_masterrawheader_t header;
static bool headerset;
static bool headerset;
dns_name_t dns_origin;
char origin[sizeof(TEST_ORIGIN)];
unsigned char name_buf[BUFLEN];
dns_name_t dns_origin;
char origin[sizeof(TEST_ORIGIN)];
unsigned char name_buf[BUFLEN];
dns_rdatacallbacks_t callbacks;
char * include_file = NULL;
char *include_file = NULL;
static void
rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *header);
static void rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *header);
static isc_result_t
add_callback(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset)
{
char buf[BIGBUFLEN];
add_callback(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset) {
char buf[BIGBUFLEN];
isc_buffer_t target;
isc_result_t result;
@@ -100,8 +95,7 @@ add_callback(void *arg, const dns_name_t *owner, dns_rdataset_t *dataset)
}
static void
rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h)
{
rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h) {
UNUSED(zone);
header = *h;
headerset = true;
@@ -109,10 +103,9 @@ rawdata_callback(dns_zone_t *zone, dns_masterrawheader_t *h)
static isc_result_t
setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
void (*error)(struct dns_rdatacallbacks *, const char *, ...))
{
void (*error)(struct dns_rdatacallbacks *, const char *, ...)) {
isc_result_t result;
int len;
int len;
isc_buffer_t source;
isc_buffer_t target;
@@ -148,8 +141,7 @@ setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
static isc_result_t
test_master(const char *testfile, dns_masterformat_t format,
void (*warn)(struct dns_rdatacallbacks *, const char *, ...),
void (*error)(struct dns_rdatacallbacks *, const char *, ...))
{
void (*error)(struct dns_rdatacallbacks *, const char *, ...)) {
isc_result_t result;
result = setup_master(warn, error);
@@ -175,8 +167,7 @@ test_master(const char *testfile, dns_masterformat_t format,
}
static void
include_callback(const char *filename, void *arg)
{
include_callback(const char *filename, void *arg) {
char **argp = (char **)arg;
*argp = isc_mem_strdup(dt_mctx, filename);
}
@@ -186,8 +177,7 @@ include_callback(const char *filename, void *arg)
* dns_master_loadfile() loads a valid master file and returns success
*/
static void
load_test(void **state)
{
load_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -202,8 +192,7 @@ load_test(void **state)
* dns_master_loadfile() returns DNS_R_UNEXPECTED when file ends too soon
*/
static void
unexpected_test(void **state)
{
unexpected_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -219,8 +208,7 @@ unexpected_test(void **state)
* if it is an SOA
*/
static void
noowner_test(void **state)
{
noowner_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -236,8 +224,7 @@ noowner_test(void **state)
* specified
*/
static void
nottl_test(void **state)
{
nottl_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -253,8 +240,7 @@ nottl_test(void **state)
* match zone class
*/
static void
badclass_test(void **state)
{
badclass_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -269,8 +255,7 @@ badclass_test(void **state)
* dns_master_loadfile() returns ISC_R_NOSPACE when record is too big
*/
static void
toobig_test(void **state)
{
toobig_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -285,8 +270,7 @@ toobig_test(void **state)
* dns_master_loadfile() returns ISC_R_SUCCESS when record is maximum size
*/
static void
maxrdata_test(void **state)
{
maxrdata_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -301,8 +285,7 @@ maxrdata_test(void **state)
* dns_master_loadfile() understands DNSKEY with key material
*/
static void
dnskey_test(void **state)
{
dnskey_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -320,8 +303,7 @@ dnskey_test(void **state)
* be rejected.
*/
static void
dnsnokey_test(void **state)
{
dnsnokey_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -336,8 +318,7 @@ dnsnokey_test(void **state)
* dns_master_loadfile() understands $INCLUDE
*/
static void
include_test(void **state)
{
include_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -352,10 +333,9 @@ include_test(void **state)
* dns_master_loadfile4() returns names of included file
*/
static void
master_includelist_test(void **state)
{
master_includelist_test(void **state) {
isc_result_t result;
char * filename = NULL;
char *filename = NULL;
UNUSED(state);
@@ -379,8 +359,7 @@ master_includelist_test(void **state)
* dns_master_loadfile() understands $INCLUDE failures
*/
static void
includefail_test(void **state)
{
includefail_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -395,8 +374,7 @@ includefail_test(void **state)
* dns_master_loadfile() handles non-empty blank lines
*/
static void
blanklines_test(void **state)
{
blanklines_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -412,8 +390,7 @@ blanklines_test(void **state)
*/
static void
leadingzero_test(void **state)
{
leadingzero_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -425,13 +402,12 @@ leadingzero_test(void **state)
/* masterfile totext tests */
static void
totext_test(void **state)
{
isc_result_t result;
dns_rdataset_t rdataset;
totext_test(void **state) {
isc_result_t result;
dns_rdataset_t rdataset;
dns_rdatalist_t rdatalist;
isc_buffer_t target;
unsigned char buf[BIGBUFLEN];
isc_buffer_t target;
unsigned char buf[BIGBUFLEN];
UNUSED(state);
@@ -464,8 +440,7 @@ totext_test(void **state)
* dns_master_loadfile() loads a valid raw file and returns success
*/
static void
loadraw_test(void **state)
{
loadraw_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -498,16 +473,15 @@ loadraw_test(void **state)
* dns_master_dump*() functions dump valid raw files
*/
static void
dumpraw_test(void **state)
{
isc_result_t result;
dns_db_t * db = NULL;
dumpraw_test(void **state) {
isc_result_t result;
dns_db_t *db = NULL;
dns_dbversion_t *version = NULL;
char myorigin[sizeof(TEST_ORIGIN)];
dns_name_t dnsorigin;
isc_buffer_t source, target;
unsigned char namebuf[BUFLEN];
int len;
char myorigin[sizeof(TEST_ORIGIN)];
dns_name_t dnsorigin;
isc_buffer_t source, target;
unsigned char namebuf[BUFLEN];
int len;
UNUSED(state);
@@ -566,12 +540,11 @@ dumpraw_test(void **state)
}
static const char *warn_expect_value;
static bool warn_expect_result;
static bool warn_expect_result;
static void
warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...)
{
char buf[4096];
warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...) {
char buf[4096];
va_list ap;
UNUSED(mycallbacks);
@@ -582,8 +555,8 @@ warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...)
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
if (warn_expect_value != NULL &&
strstr(buf, warn_expect_value) != NULL) {
if (warn_expect_value != NULL && strstr(buf, warn_expect_value) != NULL)
{
warn_expect_result = true;
}
}
@@ -593,8 +566,7 @@ warn_expect(struct dns_rdatacallbacks *mycallbacks, const char *fmt, ...)
* dns_master_loadfile() rejects zones with inherited name following $ORIGIN
*/
static void
neworigin_test(void **state)
{
neworigin_test(void **state) {
isc_result_t result;
UNUSED(state);
@@ -607,8 +579,7 @@ neworigin_test(void **state)
}
int
main(void)
{
main(void) {
const struct CMUnitTest tests[] = {
cmocka_unit_test_setup_teardown(load_test, _setup, _teardown),
cmocka_unit_test_setup_teardown(unexpected_test, _setup,
@@ -651,8 +622,7 @@ main(void)
#include <stdio.h>
int
main(void)
{
main(void) {
printf("1..0 # Skipped: cmocka not available\n");
return (0);
}