mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:53: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
|
|
@ -656,9 +656,9 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||
"random" */
|
||||
/* how many port numbers to try to bind to, increasing one at a time */
|
||||
int portnum = data->set.localportrange;
|
||||
const char *dev = data->set.str[STRING_DEVICE];
|
||||
const char *iface_input = data->set.str[STRING_INTERFACE];
|
||||
const char *host_input = data->set.str[STRING_BINDHOST];
|
||||
const char *dev = CURL_EASY_STR(data, STRING_DEVICE);
|
||||
const char *iface_input = CURL_EASY_STR(data, STRING_INTERFACE);
|
||||
const char *host_input = CURL_EASY_STR(data, STRING_BINDHOST);
|
||||
const char *iface = iface_input ? iface_input : dev;
|
||||
const char *host = host_input ? host_input : dev;
|
||||
int sockerr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue