From 99eb2ebaa9d5c8951d93062b0c19d48a9aead807 Mon Sep 17 00:00:00 2001 From: Michal Nowak Date: Tue, 23 Apr 2024 16:33:07 +0200 Subject: [PATCH] Update sources to Clang 18 formatting (cherry picked from commit f454fa6deab1b007c9412cbc6b3e3d779904d12c) --- bin/named/server.c | 4 ++-- contrib/dlz/bin/dlzbdb/dlzbdb.c | 2 +- contrib/dlz/drivers/dlz_ldap_driver.c | 2 +- contrib/dlz/drivers/dlz_odbc_driver.c | 2 +- contrib/dlz/example/win32/DLLMain.c | 2 +- lib/bind9/win32/DLLMain.c | 2 +- lib/dns/include/dns/librpz.h | 2 +- lib/dns/include/dns/rpz.h | 2 +- lib/dns/rrl.c | 26 ++------------------------ lib/dns/win32/DLLMain.c | 2 +- lib/dns/zone.c | 2 +- lib/irs/win32/DLLMain.c | 2 +- lib/isc/include/isc/util.h | 4 ++-- lib/isc/win32/DLLMain.c | 2 +- lib/isccc/win32/DLLMain.c | 2 +- lib/isccfg/win32/DLLMain.c | 2 +- lib/ns/win32/DLLMain.c | 2 +- 17 files changed, 20 insertions(+), 42 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 098e21d0ac..5290fcc35d 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -152,11 +152,11 @@ #endif /* HAVE_LMDB */ #ifndef SIZE_MAX -#define SIZE_MAX ((size_t)-1) +#define SIZE_MAX ((size_t) - 1) #endif /* ifndef SIZE_MAX */ #ifndef SIZE_AS_PERCENT -#define SIZE_AS_PERCENT ((size_t)-2) +#define SIZE_AS_PERCENT ((size_t) - 2) #endif /* ifndef SIZE_AS_PERCENT */ #ifdef TUNE_LARGE diff --git a/contrib/dlz/bin/dlzbdb/dlzbdb.c b/contrib/dlz/bin/dlzbdb/dlzbdb.c index 122d49668a..e7fd6e7477 100644 --- a/contrib/dlz/bin/dlzbdb/dlzbdb.c +++ b/contrib/dlz/bin/dlzbdb/dlzbdb.c @@ -874,7 +874,7 @@ bulk_write(char type, DB *database, DBC *dbcursor, DBT *bdbkey, DBT *bdbdata) { printf("d %.*s\n", (int)retdlen, retdata); } } /* end of for (DB_MULTIPLE_INIT....) */ - } /* end of for (;;) */ + } /* end of for (;;) */ /* free the buffer we created earlier */ free(bdbdata->data); diff --git a/contrib/dlz/drivers/dlz_ldap_driver.c b/contrib/dlz/drivers/dlz_ldap_driver.c index 072d285e98..021dc86253 100644 --- a/contrib/dlz/drivers/dlz_ldap_driver.c +++ b/contrib/dlz/drivers/dlz_ldap_driver.c @@ -726,7 +726,7 @@ ldap_get_results(const char *zone, const char *record, const char *client, goto cleanup; break; } /* close switch(ldap_result) */ - } /* end for (int i = 0 i < 3; i++) */ + } /* end for (int i = 0 i < 3; i++) */ if (result != ISC_R_SUCCESS) { goto cleanup; diff --git a/contrib/dlz/drivers/dlz_odbc_driver.c b/contrib/dlz/drivers/dlz_odbc_driver.c index dae55100b7..31f3485a20 100644 --- a/contrib/dlz/drivers/dlz_odbc_driver.c +++ b/contrib/dlz/drivers/dlz_odbc_driver.c @@ -813,7 +813,7 @@ odbc_process_rs(dns_sdlzlookup_t *lookup, dbinstance_t *dbi) { ttl, data); } } /* closes bid if () */ - } /* closes switch(fields) */ + } /* closes switch(fields) */ /* clean up mem */ if (ttl_s != NULL) { diff --git a/contrib/dlz/example/win32/DLLMain.c b/contrib/dlz/example/win32/DLLMain.c index ca7693456b..68a4bbec82 100644 --- a/contrib/dlz/example/win32/DLLMain.c +++ b/contrib/dlz/example/win32/DLLMain.c @@ -19,7 +19,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/bind9/win32/DLLMain.c b/lib/bind9/win32/DLLMain.c index 62c6e53f6d..29d2bbf916 100644 --- a/lib/bind9/win32/DLLMain.c +++ b/lib/bind9/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/dns/include/dns/librpz.h b/lib/dns/include/dns/librpz.h index 110b798ec7..5169c9a16a 100644 --- a/lib/dns/include/dns/librpz.h +++ b/lib/dns/include/dns/librpz.h @@ -157,7 +157,7 @@ typedef struct { typedef uint32_t librpz_idx_t; #define LIBRPZ_IDX_NULL 0 #define LIBRPZ_IDX_MIN 1 -#define LIBRPZ_IDX_BAD ((librpz_idx_t)-1) +#define LIBRPZ_IDX_BAD ((librpz_idx_t) - 1) /** * Partial decoded results of a set of RPZ queries for a single DNS response * or iteration through the mapped file. diff --git a/lib/dns/include/dns/rpz.h b/lib/dns/include/dns/rpz.h index f0cc57838a..5ceb6a6607 100644 --- a/lib/dns/include/dns/rpz.h +++ b/lib/dns/include/dns/rpz.h @@ -88,7 +88,7 @@ typedef uint8_t dns_rpz_num_t; */ typedef uint64_t dns_rpz_zbits_t; -#define DNS_RPZ_ALL_ZBITS ((dns_rpz_zbits_t)-1) +#define DNS_RPZ_ALL_ZBITS ((dns_rpz_zbits_t) - 1) #define DNS_RPZ_INVALID_NUM DNS_RPZ_MAX_ZONES diff --git a/lib/dns/rrl.c b/lib/dns/rrl.c index a8c25259e2..b3e6ab687f 100644 --- a/lib/dns/rrl.c +++ b/lib/dns/rrl.c @@ -53,30 +53,8 @@ log_end(dns_rrl_t *rrl, dns_rrl_entry_t *e, bool early, char *log_buf, static int hash_divisor(unsigned int initial) { static uint16_t primes[] = { - 3, - 5, - 7, - 11, - 13, - 17, - 19, - 23, - 29, - 31, - 37, - 41, - 43, - 47, - 53, - 59, - 61, - 67, - 71, - 73, - 79, - 83, - 89, - 97, + 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, + 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, #if 0 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, diff --git a/lib/dns/win32/DLLMain.c b/lib/dns/win32/DLLMain.c index 62c6e53f6d..29d2bbf916 100644 --- a/lib/dns/win32/DLLMain.c +++ b/lib/dns/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/dns/zone.c b/lib/dns/zone.c index b457095907..e31916fcfc 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1008,7 +1008,7 @@ static const char *dbargv_default[] = { "rbt" }; do { \ isc_interval_t _i; \ uint32_t _j; \ - _j = (b)-isc_random_uniform((b) / 4); \ + _j = (b) - isc_random_uniform((b) / 4); \ isc_interval_set(&_i, _j, 0); \ if (isc_time_add((a), &_i, (c)) != ISC_R_SUCCESS) { \ dns_zone_log(zone, ISC_LOG_WARNING, \ diff --git a/lib/irs/win32/DLLMain.c b/lib/irs/win32/DLLMain.c index 62c6e53f6d..29d2bbf916 100644 --- a/lib/irs/win32/DLLMain.c +++ b/lib/irs/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 33965597cc..b77f1ca34c 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -369,9 +369,9 @@ mock_assert(const int result, const char *const expression, * Alignment */ #ifdef __GNUC__ -#define ISC_ALIGN(x, a) (((x) + (a)-1) & ~((typeof(x))(a)-1)) +#define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((typeof(x))(a) - 1)) #else /* ifdef __GNUC__ */ -#define ISC_ALIGN(x, a) (((x) + (a)-1) & ~((uintmax_t)(a)-1)) +#define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((uintmax_t)(a) - 1)) #endif /* ifdef __GNUC__ */ #if HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL diff --git a/lib/isc/win32/DLLMain.c b/lib/isc/win32/DLLMain.c index abaaf4031a..6b309dfa2e 100644 --- a/lib/isc/win32/DLLMain.c +++ b/lib/isc/win32/DLLMain.c @@ -23,7 +23,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process initialization or a call to diff --git a/lib/isccc/win32/DLLMain.c b/lib/isccc/win32/DLLMain.c index 62c6e53f6d..29d2bbf916 100644 --- a/lib/isccc/win32/DLLMain.c +++ b/lib/isccc/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/isccfg/win32/DLLMain.c b/lib/isccfg/win32/DLLMain.c index 5c38e89590..e2a5718b6f 100644 --- a/lib/isccfg/win32/DLLMain.c +++ b/lib/isccfg/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process diff --git a/lib/ns/win32/DLLMain.c b/lib/ns/win32/DLLMain.c index 62c6e53f6d..29d2bbf916 100644 --- a/lib/ns/win32/DLLMain.c +++ b/lib/ns/win32/DLLMain.c @@ -18,7 +18,7 @@ * Called when we enter the DLL */ __declspec(dllexport) BOOL WINAPI - DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { /* * The DLL is loading due to process