tool_writeout: bsearch the variable name

As the list of variable names grows, doing a simple loop to find the
name get increasingly worse. This switches to a bsearch.

Also: do a case sensitive check for the variable name. The names have
not been documented to be case insensitive and there is no point in
having them so.

Closes #13914
This commit is contained in:
Daniel Stenberg 2024-06-10 13:33:16 +02:00
parent 374d178f14
commit 4464c9f2c6
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 78 additions and 59 deletions

View file

@ -30,6 +30,7 @@ int jsonquoted(const char *in, size_t len,
struct curlx_dynbuf *out, bool lowercase);
void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
size_t nentries,
struct per_transfer *per, CURLcode per_result);
void headerJSON(FILE *stream, struct per_transfer *per);
void jsonWriteString(FILE *stream, const char *in, bool lowercase);