summaryrefslogtreecommitdiffstats
path: root/lib/formdata.c
diff options
context:
space:
mode:
authorCurl Upstream <curl-library@lists.haxx.se>2022-12-21 07:00:59 (GMT)
committerBrad King <brad.king@kitware.com>2023-01-27 20:58:30 (GMT)
commitdac458ddbf2b48168779821654a7e69cbd828c14 (patch)
tree8191fa2b92ceb3469c8ac5878b4ded3112f5f16c /lib/formdata.c
parentec122fff08ab9a8e56fb90126ecedb99c759011b (diff)
downloadCMake-dac458ddbf2b48168779821654a7e69cbd828c14.zip
CMake-dac458ddbf2b48168779821654a7e69cbd828c14.tar.gz
CMake-dac458ddbf2b48168779821654a7e69cbd828c14.tar.bz2
curl 2022-12-21 (c12fb3dd)
Code extracted from: https://github.com/curl/curl.git at commit c12fb3ddaf48e709a7a4deaa55ec485e4df163ee (curl-7_87_0).
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index 46542b4..b30e8de 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -59,7 +59,7 @@
*
* AddHttpPost()
*
- * Adds a HttpPost structure to the list, if parent_post is given becomes
+ * Adds an HttpPost structure to the list, if parent_post is given becomes
* a subpost of parent_post instead of a direct list element.
*
* Returns newly allocated HttpPost on success and NULL if malloc failed.
@@ -135,15 +135,13 @@ static struct FormInfo *AddFormInfo(char *value,
{
struct FormInfo *form_info;
form_info = calloc(1, sizeof(struct FormInfo));
- if(form_info) {
- if(value)
- form_info->value = value;
- if(contenttype)
- form_info->contenttype = contenttype;
- form_info->flags = HTTPPOST_FILENAME;
- }
- else
+ if(!form_info)
return NULL;
+ if(value)
+ form_info->value = value;
+ if(contenttype)
+ form_info->contenttype = contenttype;
+ form_info->flags = HTTPPOST_FILENAME;
if(parent_form_info) {
/* now, point our 'more' to the original 'more' */
@@ -199,7 +197,7 @@ static struct FormInfo *AddFormInfo(char *value,
* CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
* CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
* CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
- * CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
+ * CURL_FORMADD_MEMORY if an HttpPost struct cannot be allocated
* CURL_FORMADD_MEMORY if some allocation for string copying failed.
* CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
*
@@ -717,10 +715,10 @@ int curl_formget(struct curl_httppost *form, void *arg,
CURLcode result;
curl_mimepart toppart;
- Curl_mime_initpart(&toppart, NULL); /* default form is empty */
+ Curl_mime_initpart(&toppart); /* default form is empty */
result = Curl_getformdata(NULL, &toppart, form, NULL);
if(!result)
- result = Curl_mime_prepare_headers(&toppart, "multipart/form-data",
+ result = Curl_mime_prepare_headers(NULL, &toppart, "multipart/form-data",
NULL, MIMESTRATEGY_FORM);
while(!result) {