mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:53:32 +03:00
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:
parent
374d178f14
commit
4464c9f2c6
5 changed files with 78 additions and 59 deletions
|
|
@ -101,13 +101,14 @@ void jsonWriteString(FILE *stream, const char *in, bool lowercase)
|
|||
}
|
||||
|
||||
void ourWriteOutJSON(FILE *stream, const struct writeoutvar mappings[],
|
||||
size_t nentries,
|
||||
struct per_transfer *per, CURLcode per_result)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
fputs("{", stream);
|
||||
|
||||
for(i = 0; mappings[i].name != NULL; i++) {
|
||||
for(i = 0; i < nentries; i++) {
|
||||
if(mappings[i].writefunc &&
|
||||
mappings[i].writefunc(stream, &mappings[i], per, per_result, true))
|
||||
fputs(",", stream);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue