mirror of
https://github.com/curl/curl.git
synced 2026-07-30 12:18:08 +03:00
tidy-up: use CURL_ARRAYSIZE()
Follow-up to 13b2ea68f0 #16111
Closes #16381
This commit is contained in:
parent
1b710381ca
commit
3fd1dfc829
35 changed files with 52 additions and 64 deletions
|
|
@ -265,7 +265,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
|
|||
WCHAR prefix[3] = {0}; /* UTF-16 (1-2 WCHARs) + NUL */
|
||||
|
||||
if(MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)outs->utf8seq, -1,
|
||||
prefix, sizeof(prefix)/sizeof(prefix[0]))) {
|
||||
prefix, CURL_ARRAYSIZE(prefix))) {
|
||||
DEBUGASSERT(prefix[2] == L'\0');
|
||||
if(!WriteConsoleW(
|
||||
(HANDLE) fhnd,
|
||||
|
|
|
|||
|
|
@ -754,7 +754,7 @@ const struct LongShort *findshortopt(char letter)
|
|||
|
||||
if(!singles_done) {
|
||||
unsigned int j;
|
||||
for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {
|
||||
for(j = 0; j < CURL_ARRAYSIZE(aliases); j++) {
|
||||
if(aliases[j].letter != ' ') {
|
||||
unsigned char l = (unsigned char)aliases[j].letter;
|
||||
singles[l - ' '] = &aliases[j];
|
||||
|
|
@ -1016,7 +1016,7 @@ const struct LongShort *findlongopt(const char *opt)
|
|||
struct LongShort key;
|
||||
key.lname = opt;
|
||||
|
||||
return bsearch(&key, aliases, sizeof(aliases)/sizeof(aliases[0]),
|
||||
return bsearch(&key, aliases, CURL_ARRAYSIZE(aliases),
|
||||
sizeof(aliases[0]), findarg);
|
||||
}
|
||||
|
||||
|
|
@ -1961,7 +1961,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||
const struct TOSEntry *entry;
|
||||
find.name = nextarg;
|
||||
entry = bsearch(&find, tos_entries,
|
||||
sizeof(tos_entries)/sizeof(*tos_entries),
|
||||
CURL_ARRAYSIZE(tos_entries),
|
||||
sizeof(*tos_entries), find_tos);
|
||||
if(entry)
|
||||
config->ip_tos = entry->value;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ static struct feature_name_presentp {
|
|||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
static const char *fnames[sizeof(maybe_feature) / sizeof(maybe_feature[0])];
|
||||
static const char *fnames[CURL_ARRAYSIZE(maybe_feature)];
|
||||
const char * const *feature_names = fnames;
|
||||
size_t feature_count;
|
||||
|
||||
|
|
|
|||
|
|
@ -793,7 +793,7 @@ ParameterError str2tls_max(long *val, const char *str)
|
|||
size_t i = 0;
|
||||
if(!str)
|
||||
return PARAM_REQUIRES_PARAMETER;
|
||||
for(i = 0; i < sizeof(tls_max_array)/sizeof(tls_max_array[0]); i++) {
|
||||
for(i = 0; i < CURL_ARRAYSIZE(tls_max_array); i++) {
|
||||
if(!strcmp(str, tls_max_array[i].tls_max_str)) {
|
||||
*val = tls_max_array[i].tls_max;
|
||||
return PARAM_OK;
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
|||
if(!curlx_dyn_addn(&name, ptr, vlen)) {
|
||||
find.name = curlx_dyn_ptr(&name);
|
||||
wv = bsearch(&find,
|
||||
variables, sizeof(variables)/sizeof(variables[0]),
|
||||
variables, CURL_ARRAYSIZE(variables),
|
||||
sizeof(variables[0]), matchvar);
|
||||
}
|
||||
if(wv) {
|
||||
|
|
@ -601,7 +601,7 @@ void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
|
|||
break;
|
||||
case VAR_JSON:
|
||||
ourWriteOutJSON(stream, variables,
|
||||
sizeof(variables)/sizeof(variables[0]),
|
||||
CURL_ARRAYSIZE(variables),
|
||||
per, per_result);
|
||||
break;
|
||||
case VAR_HEADER_JSON:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue