diff options
author | Daniel Stenberg <daniel@haxx.se> | 2012-07-13 13:38:02 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2012-07-13 13:47:34 +0200 |
commit | 771e91374b7e68c8c0d20af63821c29598964fa0 (patch) | |
tree | d26a391de26dbf2612189715714593c3aa4b1f69 /lib/getinfo.c | |
parent | 1a74e54e8b820c66fb76dd1972587f42ecbe22fd (diff) | |
download | curl-771e91374b7e68c8c0d20af63821c29598964fa0.tar.gz |
getinfo: use va_end and cut off Curl_ from static funcs
va_end() needs to be used after va_start() and we don't normally use
Curl_ prefixes for purely static functions.
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r-- | lib/getinfo.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index a1998e8a7..221f05a4f 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -72,8 +72,8 @@ CURLcode Curl_initinfo(struct SessionHandle *data) return CURLE_OK; } -static CURLcode Curl_getinfo_char(struct SessionHandle *data, CURLINFO info, - char **param_charp) +static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info, + char **param_charp) { switch(info) { case CURLINFO_EFFECTIVE_URL: @@ -117,8 +117,8 @@ static CURLcode Curl_getinfo_char(struct SessionHandle *data, CURLINFO info, return CURLE_OK; } -static CURLcode Curl_getinfo_long(struct SessionHandle *data, CURLINFO info, - long *param_longp) +static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info, + long *param_longp) { curl_socket_t sockfd; @@ -203,8 +203,8 @@ static CURLcode Curl_getinfo_long(struct SessionHandle *data, CURLINFO info, return CURLE_OK; } -static CURLcode Curl_getinfo_double(struct SessionHandle *data, CURLINFO info, - double *param_doublep) +static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info, + double *param_doublep) { switch(info) { case CURLINFO_TOTAL_TIME: @@ -255,8 +255,8 @@ static CURLcode Curl_getinfo_double(struct SessionHandle *data, CURLINFO info, return CURLE_OK; } -static CURLcode Curl_getinfo_slist(struct SessionHandle *data, CURLINFO info, - struct curl_slist **param_slistp) +static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info, + struct curl_slist **param_slistp) { union { struct curl_certinfo * to_certinfo; @@ -291,9 +291,11 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) char **param_charp=NULL; struct curl_slist **param_slistp=NULL; int type; + /* default return code is to error out! */ + CURLcode ret = CURLE_BAD_FUNCTION_ARGUMENT; if(!data) - return CURLE_BAD_FUNCTION_ARGUMENT; + return ret; va_start(arg, info); @@ -301,25 +303,28 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) switch(type) { case CURLINFO_STRING: param_charp = va_arg(arg, char **); - if(NULL == param_charp) - return CURLE_BAD_FUNCTION_ARGUMENT; - return Curl_getinfo_char(data, info, param_charp); + if(NULL != param_charp) + ret = getinfo_char(data, info, param_charp); + break; case CURLINFO_LONG: param_longp = va_arg(arg, long *); - if(NULL == param_longp) - return CURLE_BAD_FUNCTION_ARGUMENT; - return Curl_getinfo_long(data, info, param_longp); + if(NULL != param_longp) + ret = getinfo_long(data, info, param_longp); + break; case CURLINFO_DOUBLE: param_doublep = va_arg(arg, double *); - if(NULL == param_doublep) - return CURLE_BAD_FUNCTION_ARGUMENT; - return Curl_getinfo_double(data, info, param_doublep); + if(NULL != param_doublep) + ret = getinfo_double(data, info, param_doublep); + break; case CURLINFO_SLIST: param_slistp = va_arg(arg, struct curl_slist **); - if(NULL == param_slistp) - return CURLE_BAD_FUNCTION_ARGUMENT; - return Curl_getinfo_slist(data, info, param_slistp); + if(NULL != param_slistp) + ret = getinfo_slist(data, info, param_slistp); + break; default: - return CURLE_BAD_FUNCTION_ARGUMENT; + break; } + + va_end(arg); + return ret; } |