mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
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.
This commit is contained in:
parent
1a74e54e8b
commit
771e91374b
@ -72,7 +72,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode Curl_getinfo_char(struct SessionHandle *data, CURLINFO info,
|
static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,
|
||||||
char **param_charp)
|
char **param_charp)
|
||||||
{
|
{
|
||||||
switch(info) {
|
switch(info) {
|
||||||
@ -117,7 +117,7 @@ static CURLcode Curl_getinfo_char(struct SessionHandle *data, CURLINFO info,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode Curl_getinfo_long(struct SessionHandle *data, CURLINFO info,
|
static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
|
||||||
long *param_longp)
|
long *param_longp)
|
||||||
{
|
{
|
||||||
curl_socket_t sockfd;
|
curl_socket_t sockfd;
|
||||||
@ -203,7 +203,7 @@ static CURLcode Curl_getinfo_long(struct SessionHandle *data, CURLINFO info,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode Curl_getinfo_double(struct SessionHandle *data, CURLINFO info,
|
static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,
|
||||||
double *param_doublep)
|
double *param_doublep)
|
||||||
{
|
{
|
||||||
switch(info) {
|
switch(info) {
|
||||||
@ -255,7 +255,7 @@ static CURLcode Curl_getinfo_double(struct SessionHandle *data, CURLINFO info,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CURLcode Curl_getinfo_slist(struct SessionHandle *data, CURLINFO info,
|
static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
|
||||||
struct curl_slist **param_slistp)
|
struct curl_slist **param_slistp)
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
@ -291,9 +291,11 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
|||||||
char **param_charp=NULL;
|
char **param_charp=NULL;
|
||||||
struct curl_slist **param_slistp=NULL;
|
struct curl_slist **param_slistp=NULL;
|
||||||
int type;
|
int type;
|
||||||
|
/* default return code is to error out! */
|
||||||
|
CURLcode ret = CURLE_BAD_FUNCTION_ARGUMENT;
|
||||||
|
|
||||||
if(!data)
|
if(!data)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
return ret;
|
||||||
|
|
||||||
va_start(arg, info);
|
va_start(arg, info);
|
||||||
|
|
||||||
@ -301,25 +303,28 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
|||||||
switch(type) {
|
switch(type) {
|
||||||
case CURLINFO_STRING:
|
case CURLINFO_STRING:
|
||||||
param_charp = va_arg(arg, char **);
|
param_charp = va_arg(arg, char **);
|
||||||
if(NULL == param_charp)
|
if(NULL != param_charp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
ret = getinfo_char(data, info, param_charp);
|
||||||
return Curl_getinfo_char(data, info, param_charp);
|
break;
|
||||||
case CURLINFO_LONG:
|
case CURLINFO_LONG:
|
||||||
param_longp = va_arg(arg, long *);
|
param_longp = va_arg(arg, long *);
|
||||||
if(NULL == param_longp)
|
if(NULL != param_longp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
ret = getinfo_long(data, info, param_longp);
|
||||||
return Curl_getinfo_long(data, info, param_longp);
|
break;
|
||||||
case CURLINFO_DOUBLE:
|
case CURLINFO_DOUBLE:
|
||||||
param_doublep = va_arg(arg, double *);
|
param_doublep = va_arg(arg, double *);
|
||||||
if(NULL == param_doublep)
|
if(NULL != param_doublep)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
ret = getinfo_double(data, info, param_doublep);
|
||||||
return Curl_getinfo_double(data, info, param_doublep);
|
break;
|
||||||
case CURLINFO_SLIST:
|
case CURLINFO_SLIST:
|
||||||
param_slistp = va_arg(arg, struct curl_slist **);
|
param_slistp = va_arg(arg, struct curl_slist **);
|
||||||
if(NULL == param_slistp)
|
if(NULL != param_slistp)
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
ret = getinfo_slist(data, info, param_slistp);
|
||||||
return Curl_getinfo_slist(data, info, param_slistp);
|
break;
|
||||||
default:
|
default:
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
va_end(arg);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user