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

@@ -34,8 +34,7 @@
#define TEST_INPUT(x) (x), sizeof(x) - 1
static int
_setup(void **state)
{
_setup(void **state) {
isc_hmac_t *hmac = isc_hmac_new();
if (hmac == NULL) {
return (-1);
@@ -45,8 +44,7 @@ _setup(void **state)
}
static int
_teardown(void **state)
{
_teardown(void **state) {
if (*state == NULL) {
return (-1);
}
@@ -55,8 +53,7 @@ _teardown(void **state)
}
static int
_reset(void **state)
{
_reset(void **state) {
if (*state == NULL) {
return (-1);
}
@@ -67,8 +64,7 @@ _reset(void **state)
}
static void
isc_hmac_new_test(void **state)
{
isc_hmac_new_test(void **state) {
UNUSED(state);
isc_hmac_t *hmac = isc_hmac_new();
@@ -77,8 +73,7 @@ isc_hmac_new_test(void **state)
}
static void
isc_hmac_free_test(void **state)
{
isc_hmac_free_test(void **state) {
UNUSED(state);
isc_hmac_t *hmac = isc_hmac_new();
@@ -90,8 +85,7 @@ isc_hmac_free_test(void **state)
static void
isc_hmac_test(isc_hmac_t *hmac, const void *key, size_t keylen,
isc_md_type_t type, const char *buf, size_t buflen,
const char *result, const int repeats)
{
const char *result, const int repeats) {
assert_non_null(hmac);
assert_int_equal(isc_hmac_init(hmac, key, keylen, type), ISC_R_SUCCESS);
@@ -105,11 +99,11 @@ isc_hmac_test(isc_hmac_t *hmac, const void *key, size_t keylen,
}
unsigned char digest[ISC_MAX_MD_SIZE];
unsigned int digestlen;
unsigned int digestlen;
assert_int_equal(isc_hmac_final(hmac, digest, &digestlen),
ISC_R_SUCCESS);
char hexdigest[ISC_MAX_MD_SIZE * 2 + 3];
char hexdigest[ISC_MAX_MD_SIZE * 2 + 3];
isc_region_t r = { .base = digest, .length = digestlen };
isc_buffer_t b;
isc_buffer_init(&b, hexdigest, sizeof(hexdigest));
@@ -121,8 +115,7 @@ isc_hmac_test(isc_hmac_t *hmac, const void *key, size_t keylen,
}
static void
isc_hmac_init_test(void **state)
{
isc_hmac_init_test(void **state) {
isc_hmac_t *hmac = *state;
assert_non_null(hmac);
@@ -158,8 +151,7 @@ isc_hmac_init_test(void **state)
}
static void
isc_hmac_update_test(void **state)
{
isc_hmac_update_test(void **state) {
isc_hmac_t *hmac = *state;
assert_non_null(hmac);
@@ -172,8 +164,7 @@ isc_hmac_update_test(void **state)
}
static void
isc_hmac_reset_test(void **state)
{
isc_hmac_reset_test(void **state) {
isc_hmac_t *hmac = *state;
#if 0
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused));
@@ -202,13 +193,12 @@ isc_hmac_reset_test(void **state)
}
static void
isc_hmac_final_test(void **state)
{
isc_hmac_final_test(void **state) {
isc_hmac_t *hmac = *state;
assert_non_null(hmac);
unsigned char digest[ISC_MAX_MD_SIZE];
unsigned int digestlen;
unsigned int digestlen;
/* Fail when message digest context is empty */
expect_assert_failure(isc_hmac_final(NULL, digest, &digestlen));
@@ -221,8 +211,7 @@ isc_hmac_final_test(void **state)
}
static void
isc_hmac_md5_test(void **state)
{
isc_hmac_md5_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -320,8 +309,7 @@ isc_hmac_md5_test(void **state)
}
static void
isc_hmac_sha1_test(void **state)
{
isc_hmac_sha1_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -405,8 +393,7 @@ isc_hmac_sha1_test(void **state)
}
static void
isc_hmac_sha224_test(void **state)
{
isc_hmac_sha224_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -530,8 +517,7 @@ isc_hmac_sha224_test(void **state)
}
static void
isc_hmac_sha256_test(void **state)
{
isc_hmac_sha256_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -655,8 +641,7 @@ isc_hmac_sha256_test(void **state)
}
static void
isc_hmac_sha384_test(void **state)
{
isc_hmac_sha384_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -786,8 +771,7 @@ isc_hmac_sha384_test(void **state)
}
static void
isc_hmac_sha512_test(void **state)
{
isc_hmac_sha512_test(void **state) {
isc_hmac_t *hmac = *state;
/* Test 0 */
@@ -918,8 +902,7 @@ isc_hmac_sha512_test(void **state)
}
int
main(void)
{
main(void) {
const struct CMUnitTest tests[] = {
/* isc_hmac_new() */
cmocka_unit_test(isc_hmac_new_test),
@@ -956,8 +939,7 @@ main(void)
#include <stdio.h>
int
main(void)
{
main(void) {
printf("1..0 # Skipped: cmocka not available\n");
return (0);
}