mirror of
https://github.com/curl/curl.git
synced 2026-08-25 20:23:32 +03:00
lib: new easy option string storage
Change the storage of easy handle option strings from an array sized for all possible options to a hash set to reduce memory footprint. Give the hash set initially room for 4 strings, with first allocation happening when it goes beyond that. Measurements without test suite and a forced fail on growing the set gives: Size Result 2 1261 tests out of 1951 reported OK: 64% 4 1792 tests out of 1951 reported OK: 91% 8 1944 tests out of 1951 reported OK: 99% 16 1949 tests out of 1951 reported OK: 99% 32 single fail of 3211, unit test for u8_strset Add u8_strset that keeps the tuples (uint8_t id, char *str) and allows set/unset by `id`. Add that as data->set.strings. Define MACROS * CURL_EASY_STR(data, id) for access * CURL_EASY_STR_SET(data, id, s) for setting, making a copy * CURL_EASY_STR_SETN(data, id, s) for setting, no copy * CURL_EASY_STR_CLEAR(data, id) for unsetting * CURL_EASY_STR_CLEAR0(data, id) for unsetting and zero-ing value Add `data->set.str_copypostfields` to handle former `STRING_COPYPOSTFIELDS` string that was not always a string and could carry NUL bytes. Add unit tests to test3211. Closes #22628
This commit is contained in:
parent
961c95fea6
commit
c8df3defd9
45 changed files with 1028 additions and 488 deletions
|
|
@ -1205,7 +1205,7 @@ CURLcode curl_easy_setopt_ccsid(CURL *curl, CURLoption tag, ...)
|
|||
}
|
||||
|
||||
result = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s);
|
||||
data->set.str[STRING_COPYPOSTFIELDS] = s; /* Give to library. */
|
||||
data->set.str_copypostfields = s; /* Give to library. */
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue