mirror of
https://github.com/curl/curl.git
synced 2026-08-25 20:23:32 +03:00
mimepost: allocate main struct on-demand
This makes the easy handle 432 bytes smaller (totally 5352 bytes on my rather maximized Linux 64 bit build). The 440 byte mimepost struct is now allocated only when needed. Closes #20260
This commit is contained in:
parent
9e0b02c19c
commit
44312b4b11
9 changed files with 79 additions and 45 deletions
|
|
@ -27,6 +27,8 @@ static CURLcode test_lib589(const char *URL)
|
|||
{
|
||||
CURL *curl;
|
||||
CURLcode result = CURLE_OK;
|
||||
curl_mime *mime = NULL;
|
||||
curl_mimepart *part;
|
||||
|
||||
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
|
||||
curl_mfprintf(stderr, "curl_global_init() failed\n");
|
||||
|
|
@ -46,13 +48,14 @@ static CURLcode test_lib589(const char *URL)
|
|||
test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */
|
||||
|
||||
if(testnum == 584) {
|
||||
curl_mime *mime = curl_mime_init(curl);
|
||||
curl_mimepart *part = curl_mime_addpart(mime);
|
||||
curl_mime_name(part, "fake");
|
||||
curl_mime_data(part, "party", 5);
|
||||
test_setopt(curl, CURLOPT_MIMEPOST, mime);
|
||||
result = curl_easy_perform(curl);
|
||||
curl_mime_free(mime);
|
||||
mime = curl_mime_init(curl);
|
||||
part = curl_mime_addpart(mime);
|
||||
if(mime && part) {
|
||||
curl_mime_name(part, "fake");
|
||||
curl_mime_data(part, "party", 5);
|
||||
test_setopt(curl, CURLOPT_MIMEPOST, mime);
|
||||
result = curl_easy_perform(curl);
|
||||
}
|
||||
if(result)
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
|
@ -65,6 +68,7 @@ static CURLcode test_lib589(const char *URL)
|
|||
test_cleanup:
|
||||
|
||||
/* always cleanup */
|
||||
curl_mime_free(mime);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ static void checksize(const char *name, size_t size, size_t allowed)
|
|||
}
|
||||
|
||||
/* the maximum sizes we allow specific structs to grow to */
|
||||
#define MAX_CURL_EASY 5850
|
||||
#define MAX_CURL_EASY 5370
|
||||
#define MAX_CONNECTDATA 1300
|
||||
#define MAX_CURL_MULTI 850
|
||||
#define MAX_CURL_HTTPPOST 112
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue