curl-library
[PATCH 1/5] curl_easy_getinfo: Add va() API function
From: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
Date: Fri, 20 Jan 2017 17:42:40 +0200
Date: Fri, 20 Jan 2017 17:42:40 +0200
Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu_at_ni.com>
---
docs/libcurl/curl_easy_getinfo.3 | 7 ++++++-
include/curl/easy.h | 7 ++++++-
lib/easy.c | 22 +++++++++++++++-------
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/docs/libcurl/curl_easy_getinfo.3 b/docs/libcurl/curl_easy_getinfo.3
index fabc7e92f..6edf41d8d 100644
--- a/docs/libcurl/curl_easy_getinfo.3
+++ b/docs/libcurl/curl_easy_getinfo.3
@@ -22,12 +22,14 @@
.\"
.TH curl_easy_getinfo 3 "11 Feb 2009" "libcurl 7.19.4" "libcurl Manual"
.SH NAME
-curl_easy_getinfo - extract information from a curl handle
+curl_easy_getinfo,curl_easy_getinfo_va - extract information from a curl handle
.SH SYNOPSIS
.B #include <curl/curl.h>
.B "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
+.B "CURLcode curl_easy_getinfo_va(CURL *curl, CURLINFO info, va_list params);"
+
.SH DESCRIPTION
Request internal information from the curl session with this function. The
third argument \fBMUST\fP be a pointer to a long, a pointer to a char *, a
@@ -37,6 +39,9 @@ accordingly and can be relied upon only if the function returns CURLE_OK. Use
this function AFTER a performed transfer if you want to get transfer related
data.
+For curl_share_setopt_va the first element of the va_list \fBMUST\fP conform to
+the specification for the third argument of curl_share_setopt above.
+
You should not free the memory returned by this function unless it is
explicitly mentioned below.
.SH AVAILABLE INFORMATION
diff --git a/include/curl/easy.h b/include/curl/easy.h
index 752c5049f..2db58d03e 100644
--- a/include/curl/easy.h
+++ b/include/curl/easy.h
@@ -31,7 +31,7 @@ CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
/*
- * NAME curl_easy_getinfo()
+ * NAME curl_easy_getinfo()/curl_easy_getinfo_va()
*
* DESCRIPTION
*
@@ -42,9 +42,14 @@ CURL_EXTERN void curl_easy_cleanup(CURL *curl);
* function returns CURLE_OK. This function is intended to get used *AFTER* a
* performed transfer, all results from this function are undefined until the
* transfer is completed.
+ *
+ * The first element of the va_list arg of curl_easy_getinfo_va MUST conform to
+ * the specification of the third arg of curl_easy_getinfo above.
+ *
*/
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
+CURL_EXTERN CURLcode curl_easy_getinfo_va(CURL *curl, CURLINFO info, va_list params);
/*
* NAME curl_easy_duphandle()
diff --git a/lib/easy.c b/lib/easy.c
index bed94a444..0fbc9cb41 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -835,22 +835,30 @@ void curl_easy_cleanup(struct Curl_easy *data)
}
/*
- * curl_easy_getinfo() is an external interface that allows an app to retrieve
- * information from a performed transfer and similar.
+ * curl_easy_getinfo()/curl_easy_getinfo_va() are external interfaces that
+ * allow an app to retrieve information from a performed transfer and similar.
*/
-#undef curl_easy_getinfo
-CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...)
+CURLcode curl_easy_getinfo_va(struct Curl_easy *data, CURLINFO info, va_list arg)
{
- va_list arg;
void *paramp;
CURLcode result;
- va_start(arg, info);
paramp = va_arg(arg, void *);
-
result = Curl_getinfo(data, info, paramp);
+ return result;
+}
+
+#undef curl_easy_getinfo
+CURLcode curl_easy_getinfo(struct Curl_easy *data, CURLINFO info, ...)
+{
+ va_list arg;
+ CURLcode result;
+
+ va_start(arg, info);
+ result = curl_easy_getinfo_va(data, info, 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.html
Received on 2017-01-20