curl-library
[PATCH 4/5] curl_multi_setopt: Add va() API function
From: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
Date: Fri, 20 Jan 2017 17:42:43 +0200
Date: Fri, 20 Jan 2017 17:42:43 +0200
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
--- docs/libcurl/curl_multi_setopt.3 | 6 +++++- include/curl/multi.h | 5 ++++- lib/multi.c | 22 ++++++++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/docs/libcurl/curl_multi_setopt.3 b/docs/libcurl/curl_multi_setopt.3 index d27c52441..56f68fb03 100644 --- a/docs/libcurl/curl_multi_setopt.3 +++ b/docs/libcurl/curl_multi_setopt.3 @@ -21,11 +21,13 @@ .\" ************************************************************************** .TH curl_multi_setopt 3 "4 Nov 2014" "libcurl 7.39.0" "libcurl Manual" .SH NAME -curl_multi_setopt \- set options for a curl multi handle +curl_multi_setopt,curl_multi_setopt_va \- set options for a curl multi handle .SH SYNOPSIS #include <curl/curl.h> CURLMcode curl_multi_setopt(CURLM * multi_handle, CURLMoption option, param); + +CURLMcode curl_multi_setopt_va(CURLM * multi_handle, CURLMoption option, va_list params); .SH DESCRIPTION \fIcurl_multi_setopt(3)\fP is used to tell a libcurl multi handle how to behave. By using the appropriate options to \fIcurl_multi_setopt(3)\fP, you @@ -36,6 +38,8 @@ pointer\fP or a \fBcurl_off_t\fP type, depending on what the specific option expects. Read this manual carefully as bad input values may cause libcurl to behave badly! You can only set one option in each function call. +For curl_multi_setopt_va the first element of the va_list should contain \fIparam\fP. + .SH OPTIONS .IP CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE See \fICURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)\fP diff --git a/include/curl/multi.h b/include/curl/multi.h index d1e00cc5d..fcc3c0e67 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -385,7 +385,7 @@ typedef enum { /* - * Name: curl_multi_setopt() + * Name: curl_multi_setopt()/curl_multi_setopt_va() * * Desc: Sets options for the multi handle. * @@ -394,6 +394,9 @@ typedef enum { CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option, ...); +CURL_EXTERN CURLMcode curl_multi_setopt_va(CURLM *multi_handle, + CURLMoption option, + va_list params); /* * Name: curl_multi_assign() diff --git a/lib/multi.c b/lib/multi.c index 950b600cb..d8d483da3 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -2666,18 +2666,14 @@ static CURLMcode multi_socket(struct Curl_multi *multi, return result; } -#undef curl_multi_setopt -CURLMcode curl_multi_setopt(struct Curl_multi *multi, - CURLMoption option, ...) +CURLMcode curl_multi_setopt_va(struct Curl_multi *multi, + CURLMoption option, va_list param) { CURLMcode res = CURLM_OK; - va_list param; if(!GOOD_MULTI_HANDLE(multi)) return CURLM_BAD_HANDLE; - va_start(param, option); - switch(option) { case CURLMOPT_SOCKETFUNCTION: multi->socket_cb = va_arg(param, curl_socket_callback); @@ -2730,7 +2726,21 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi, res = CURLM_UNKNOWN_OPTION; break; } + + return res; +} + +#undef curl_multi_setopt +CURLMcode curl_multi_setopt(struct Curl_multi *multi, + CURLMoption option, ...) +{ + CURLMcode res; + va_list param; + + va_start(param, option); + res = curl_multi_setopt_va(multi, option, param); va_end(param); + return res; } -- 2.11.0 ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2017-01-20