summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/getinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmcurl/lib/getinfo.c')
-rw-r--r--Utilities/cmcurl/lib/getinfo.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/Utilities/cmcurl/lib/getinfo.c b/Utilities/cmcurl/lib/getinfo.c
index 8905d36..910f520 100644
--- a/Utilities/cmcurl/lib/getinfo.c
+++ b/Utilities/cmcurl/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -27,12 +27,12 @@
#include "urldata.h"
#include "getinfo.h"
-#include "curl_memory.h"
#include "vtls/vtls.h"
#include "connect.h" /* Curl_getconnectinfo() */
#include "progress.h"
-/* Make this the last #include */
+/* The last #include files should be: */
+#include "curl_memory.h"
#include "memdebug.h"
/*
@@ -42,7 +42,7 @@
CURLcode Curl_initinfo(struct SessionHandle *data)
{
struct Progress *pro = &data->progress;
- struct PureInfo *info =&data->info;
+ struct PureInfo *info = &data->info;
pro->t_nslookup = 0;
pro->t_connect = 0;
@@ -58,8 +58,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
info->filetime = -1; /* -1 is an illegal time and thus means unknown */
info->timecond = FALSE;
- if(info->contenttype)
- free(info->contenttype);
+ free(info->contenttype);
info->contenttype = NULL;
info->header_size = 0;
@@ -116,6 +115,7 @@ static CURLcode getinfo_char(struct SessionHandle *data, CURLINFO info,
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
+
return CURLE_OK;
}
@@ -202,6 +202,7 @@ static CURLcode getinfo_long(struct SessionHandle *data, CURLINFO info,
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
+
return CURLE_OK;
}
@@ -254,6 +255,7 @@ static CURLcode getinfo_double(struct SessionHandle *data, CURLINFO info,
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
+
return CURLE_OK;
}
@@ -261,8 +263,8 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
struct curl_slist **param_slistp)
{
union {
- struct curl_certinfo * to_certinfo;
- struct curl_slist * to_slist;
+ struct curl_certinfo *to_certinfo;
+ struct curl_slist *to_slist;
} ptr;
switch(info) {
@@ -303,7 +305,7 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
break; /* no SSL session found */
/* Return the TLS session information from the relevant backend */
-#ifdef USE_SSLEAY
+#ifdef USE_OPENSSL
internals = conn->ssl[sockindex].ctx;
#endif
#ifdef USE_GNUTLS
@@ -312,9 +314,6 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
#ifdef USE_NSS
internals = conn->ssl[sockindex].handle;
#endif
-#ifdef USE_QSOSSL
- internals = conn->ssl[sockindex].handle;
-#endif
#ifdef USE_GSKIT
internals = conn->ssl[sockindex].handle;
#endif
@@ -331,22 +330,23 @@ static CURLcode getinfo_slist(struct SessionHandle *data, CURLINFO info,
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
+
return CURLE_OK;
}
CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
{
va_list arg;
- long *param_longp=NULL;
- double *param_doublep=NULL;
- char **param_charp=NULL;
- struct curl_slist **param_slistp=NULL;
+ long *param_longp = NULL;
+ double *param_doublep = NULL;
+ 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;
+ CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT;
if(!data)
- return ret;
+ return result;
va_start(arg, info);
@@ -354,28 +354,29 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
switch(type) {
case CURLINFO_STRING:
param_charp = va_arg(arg, char **);
- if(NULL != param_charp)
- ret = getinfo_char(data, info, param_charp);
+ if(param_charp)
+ result = getinfo_char(data, info, param_charp);
break;
case CURLINFO_LONG:
param_longp = va_arg(arg, long *);
- if(NULL != param_longp)
- ret = getinfo_long(data, info, param_longp);
+ if(param_longp)
+ result = getinfo_long(data, info, param_longp);
break;
case CURLINFO_DOUBLE:
param_doublep = va_arg(arg, double *);
- if(NULL != param_doublep)
- ret = getinfo_double(data, info, param_doublep);
+ if(param_doublep)
+ result = getinfo_double(data, info, param_doublep);
break;
case CURLINFO_SLIST:
param_slistp = va_arg(arg, struct curl_slist **);
- if(NULL != param_slistp)
- ret = getinfo_slist(data, info, param_slistp);
+ if(param_slistp)
+ result = getinfo_slist(data, info, param_slistp);
break;
default:
break;
}
va_end(arg);
- return ret;
+
+ return result;
}