curl-library
[PATCH 3/5] curl_formadd: Add va() API function
From: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
Date: Fri, 20 Jan 2017 17:42:42 +0200
Date: Fri, 20 Jan 2017 17:42:42 +0200
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
--- docs/libcurl/curl_formadd.3 | 5 ++++- include/curl/curl.h | 6 +++++- lib/formdata.c | 12 ++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/docs/libcurl/curl_formadd.3 b/docs/libcurl/curl_formadd.3 index 5d1faa532..36fcf6b6b 100644 --- a/docs/libcurl/curl_formadd.3 +++ b/docs/libcurl/curl_formadd.3 @@ -21,12 +21,15 @@ .\" ************************************************************************** .TH curl_formadd 3 "24 June 2002" "libcurl 7.9.8" "libcurl Manual" .SH NAME -curl_formadd - add a section to a multipart/formdata HTTP POST +curl_formadd, curl_formadd_va - add a section to a multipart/formdata HTTP POST .SH SYNOPSIS .B #include <curl/curl.h> .sp .BI "CURLFORMcode curl_formadd(struct curl_httppost ** " firstitem, .BI "struct curl_httppost ** " lastitem, " ...);" + +.BI "CURLFORMcode curl_formadd_va(struct curl_httppost ** " firstitem, +.BI "struct curl_httppost ** " lastitem, " va_list arg);" .ad .SH DESCRIPTION curl_formadd() is used to append sections when building a multipart/formdata diff --git a/include/curl/curl.h b/include/curl/curl.h index 467bb0240..36ecf53cd 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2003,7 +2003,7 @@ typedef enum { } CURLFORMcode; /* - * NAME curl_formadd() + * NAME curl_formadd()/curl_formadd_va() * * DESCRIPTION * @@ -2015,6 +2015,10 @@ CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost, struct curl_httppost **last_post, ...); +CURL_EXTERN CURLFORMcode curl_formadd_va(struct curl_httppost **httppost, + struct curl_httppost **last_post, + va_list arg); + /* * callback function for curl_formget() * The void *arg pointer will be the one passed as second argument to diff --git a/lib/formdata.c b/lib/formdata.c index c12227623..61eca92c1 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -733,11 +733,19 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost, } /* - * curl_formadd() is a public API to add a section to the multipart formpost. + * curl_formadd()/curl_formadd_va() are public APIs to add a section to + * the multipart formpost. * * @unittest: 1308 */ +CURLFORMcode curl_formadd_va(struct curl_httppost **httppost, + struct curl_httppost **last_post, + va_list arg) +{ + return FormAdd(httppost, last_post, arg); +} + CURLFORMcode curl_formadd(struct curl_httppost **httppost, struct curl_httppost **last_post, ...) @@ -745,7 +753,7 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost, va_list arg; CURLFORMcode result; va_start(arg, last_post); - result = FormAdd(httppost, last_post, arg); + result = curl_formadd_va(httppost, last_post, arg); va_end(arg); return result; } -- 2.11.0 ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2017-01-20