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 commitd3b49b6675)0255a974revise .clang-format and add a C formatting script in utile851ed0bapply the modified style
This commit is contained in:
@@ -48,8 +48,7 @@
|
||||
#include <dst/dst.h>
|
||||
|
||||
static int
|
||||
_setup(void **state)
|
||||
{
|
||||
_setup(void **state) {
|
||||
isc_result_t result;
|
||||
|
||||
UNUSED(state);
|
||||
@@ -61,8 +60,7 @@ _setup(void **state)
|
||||
}
|
||||
|
||||
static int
|
||||
_teardown(void **state)
|
||||
{
|
||||
_teardown(void **state) {
|
||||
UNUSED(state);
|
||||
|
||||
dns_test_end();
|
||||
@@ -76,9 +74,9 @@ _teardown(void **state)
|
||||
*/
|
||||
typedef struct {
|
||||
dns_diffop_t op;
|
||||
const char * owner;
|
||||
dns_ttl_t ttl;
|
||||
const char * type;
|
||||
const char *owner;
|
||||
dns_ttl_t ttl;
|
||||
const char *type;
|
||||
} zonediff_t;
|
||||
|
||||
#define ZONEDIFF_SENTINEL \
|
||||
@@ -90,10 +88,10 @@ typedef struct {
|
||||
* Structure defining a dns__zone_updatesigs() test.
|
||||
*/
|
||||
typedef struct {
|
||||
const char * description; /* test description */
|
||||
const zonechange_t *changes; /* array of "raw" zone changes */
|
||||
const zonediff_t * zonediff; /* array of "processed" zone changes
|
||||
* */
|
||||
const char *description; /* test description */
|
||||
const zonechange_t *changes; /* array of "raw" zone changes */
|
||||
const zonediff_t *zonediff; /* array of "processed" zone changes
|
||||
* */
|
||||
} updatesigs_test_params_t;
|
||||
|
||||
/*%
|
||||
@@ -101,18 +99,18 @@ typedef struct {
|
||||
* the 'index'th tuple output by dns__zone_updatesigs() in test 'test'.
|
||||
*/
|
||||
static void
|
||||
compare_tuples(const zonediff_t *expected, dns_difftuple_t *found, size_t index)
|
||||
{
|
||||
char found_covers[DNS_RDATATYPE_FORMATSIZE] = {};
|
||||
char found_type[DNS_RDATATYPE_FORMATSIZE] = {};
|
||||
char found_name[DNS_NAME_FORMATSIZE];
|
||||
compare_tuples(const zonediff_t *expected, dns_difftuple_t *found,
|
||||
size_t index) {
|
||||
char found_covers[DNS_RDATATYPE_FORMATSIZE] = {};
|
||||
char found_type[DNS_RDATATYPE_FORMATSIZE] = {};
|
||||
char found_name[DNS_NAME_FORMATSIZE];
|
||||
isc_consttextregion_t typeregion;
|
||||
dns_fixedname_t expected_fname;
|
||||
dns_rdatatype_t expected_type;
|
||||
dns_name_t * expected_name;
|
||||
dns_rdata_rrsig_t rrsig;
|
||||
isc_buffer_t typebuf;
|
||||
isc_result_t result;
|
||||
dns_fixedname_t expected_fname;
|
||||
dns_rdatatype_t expected_type;
|
||||
dns_name_t *expected_name;
|
||||
dns_rdata_rrsig_t rrsig;
|
||||
isc_buffer_t typebuf;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(expected != NULL);
|
||||
REQUIRE(found != NULL);
|
||||
@@ -127,8 +125,8 @@ compare_tuples(const zonediff_t *expected, dns_difftuple_t *found, size_t index)
|
||||
* Check owner name.
|
||||
*/
|
||||
expected_name = dns_fixedname_initname(&expected_fname);
|
||||
result =
|
||||
dns_name_fromstring(expected_name, expected->owner, 0, dt_mctx);
|
||||
result = dns_name_fromstring(expected_name, expected->owner, 0,
|
||||
dt_mctx);
|
||||
assert_int_equal(result, ISC_R_SUCCESS);
|
||||
dns_name_format(&found->name, found_name, sizeof(found_name));
|
||||
assert_true(dns_name_equal(expected_name, &found->name));
|
||||
@@ -194,14 +192,13 @@ compare_tuples(const zonediff_t *expected, dns_difftuple_t *found, size_t index)
|
||||
static void
|
||||
updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone,
|
||||
dns_db_t *db, dst_key_t *zone_keys[], unsigned int nkeys,
|
||||
isc_stdtime_t now)
|
||||
{
|
||||
size_t tuples_expected, tuples_found, index;
|
||||
dns_dbversion_t * version = NULL;
|
||||
dns_diff_t raw_diff, zone_diff;
|
||||
isc_stdtime_t now) {
|
||||
size_t tuples_expected, tuples_found, index;
|
||||
dns_dbversion_t *version = NULL;
|
||||
dns_diff_t raw_diff, zone_diff;
|
||||
const zonediff_t *expected;
|
||||
dns_difftuple_t * found;
|
||||
isc_result_t result;
|
||||
dns_difftuple_t *found;
|
||||
isc_result_t result;
|
||||
|
||||
dns__zonediff_t zonediff = {
|
||||
.diff = &zone_diff,
|
||||
@@ -260,7 +257,8 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone,
|
||||
|
||||
tuples_found = 0;
|
||||
for (found = ISC_LIST_HEAD(zone_diff.tuples); found != NULL;
|
||||
found = ISC_LIST_NEXT(found, link)) {
|
||||
found = ISC_LIST_NEXT(found, link))
|
||||
{
|
||||
tuples_found++;
|
||||
}
|
||||
|
||||
@@ -272,7 +270,8 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone,
|
||||
expected = test->zonediff;
|
||||
index = 1;
|
||||
for (found = ISC_LIST_HEAD(zone_diff.tuples); found != NULL;
|
||||
found = ISC_LIST_NEXT(found, link)) {
|
||||
found = ISC_LIST_NEXT(found, link))
|
||||
{
|
||||
compare_tuples(expected, found, index);
|
||||
expected++;
|
||||
index++;
|
||||
@@ -288,15 +287,14 @@ updatesigs_test(const updatesigs_test_params_t *test, dns_zone_t *zone,
|
||||
|
||||
/* dns__zone_updatesigs() tests */
|
||||
static void
|
||||
updatesigs_next_test(void **state)
|
||||
{
|
||||
dst_key_t * zone_keys[DNS_MAXZONEKEYS];
|
||||
dns_zone_t * zone = NULL;
|
||||
dns_db_t * db = NULL;
|
||||
isc_result_t result;
|
||||
unsigned int nkeys;
|
||||
updatesigs_next_test(void **state) {
|
||||
dst_key_t *zone_keys[DNS_MAXZONEKEYS];
|
||||
dns_zone_t *zone = NULL;
|
||||
dns_db_t *db = NULL;
|
||||
isc_result_t result;
|
||||
unsigned int nkeys;
|
||||
isc_stdtime_t now;
|
||||
size_t i;
|
||||
size_t i;
|
||||
|
||||
UNUSED(state);
|
||||
|
||||
@@ -440,8 +438,7 @@ updatesigs_next_test(void **state)
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
main(void) {
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(updatesigs_next_test, _setup,
|
||||
_teardown),
|
||||
@@ -455,8 +452,7 @@ 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