tidy-up: use CURL_ARRAYSIZE()

Follow-up to 13b2ea68f0 #16111

Closes #16381
This commit is contained in:
Viktor Szakats 2025-02-18 14:48:18 +01:00
parent 1b710381ca
commit 3fd1dfc829
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
35 changed files with 52 additions and 64 deletions

View file

@ -484,7 +484,7 @@ static const uint16_t ciphertable[] = {
BR_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, /* 0xCCA9 */
};
#define NUM_OF_CIPHERS (sizeof(ciphertable) / sizeof(ciphertable[0]))
#define NUM_OF_CIPHERS CURL_ARRAYSIZE(ciphertable)
static CURLcode bearssl_set_selected_ciphers(struct Curl_easy *data,
br_ssl_engine_context *ssl_eng,

View file

@ -725,7 +725,7 @@ static const struct cs_entry cs_list [] = {
CS_ENTRY(0xCCAE, RSA,PSK,CHACHA20,POLY1305,,,,),
#endif
};
#define CS_LIST_LEN (sizeof(cs_list) / sizeof(cs_list[0]))
#define CS_LIST_LEN CURL_ARRAYSIZE(cs_list)
static int cs_str_to_zip(const char *cs_str, size_t cs_len,
uint8_t zip[6])

View file

@ -211,9 +211,6 @@ static const uint16_t default_ciphers[] = {
#endif /* CURL_BUILD_MAC_10_13 || CURL_BUILD_IOS_11 */
};
#define DEFAULT_CIPHERS_LEN sizeof(default_ciphers)/sizeof(default_ciphers[0])
/* pinned public key support tests */
/* version 1 supports macOS 10.12+ and iOS 10+ */
@ -925,7 +922,7 @@ static CURLcode sectransp_set_default_ciphers(struct Curl_easy *data,
/* Intersect the ciphers supported by Secure Transport with the default
* ciphers, using the order of the former. */
for(i = 0; i < supported_len; i++) {
for(j = 0; j < DEFAULT_CIPHERS_LEN; j++) {
for(j = 0; j < CURL_ARRAYSIZE(default_ciphers); j++) {
if(default_ciphers[j] == ciphers[i]) {
ciphers[count++] = ciphers[i];
break;