tidy-up: make per-file ARRAYSIZE macros global as CURL_ARRAYSIZE

Closes #16111
This commit is contained in:
Viktor Szakats 2025-01-28 12:09:55 +01:00
parent 9da9a0226d
commit 13b2ea68f0
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
13 changed files with 37 additions and 84 deletions

View file

@ -36,10 +36,6 @@
#include "memdebug.h" /* keep this as LAST include */
#ifndef ARRAYSIZE
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif
struct category_descriptors {
const char *opt;
const char *desc;
@ -113,7 +109,7 @@ static void print_category(unsigned int category, unsigned int cols)
static int get_category_content(const char *category, unsigned int cols)
{
unsigned int i;
for(i = 0; i < ARRAYSIZE(categories); ++i)
for(i = 0; i < CURL_ARRAYSIZE(categories); ++i)
if(curl_strequal(categories[i].opt, category)) {
printf("%s: %s\n", categories[i].opt, categories[i].desc);
print_category(categories[i].category, cols);
@ -126,7 +122,7 @@ static int get_category_content(const char *category, unsigned int cols)
static void get_categories(void)
{
unsigned int i;
for(i = 0; i < ARRAYSIZE(categories); ++i)
for(i = 0; i < CURL_ARRAYSIZE(categories); ++i)
printf(" %-11s %s\n", categories[i].opt, categories[i].desc);
}
@ -135,9 +131,9 @@ static void get_categories_list(unsigned int width)
{
unsigned int i;
size_t col = 0;
for(i = 0; i < ARRAYSIZE(categories); ++i) {
for(i = 0; i < CURL_ARRAYSIZE(categories); ++i) {
size_t len = strlen(categories[i].opt);
if(i == ARRAYSIZE(categories) - 1) {
if(i == CURL_ARRAYSIZE(categories) - 1) {
/* final category */
if(col + len + 1 < width)
printf("%s.\n", categories[i].opt);