aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Bakken <agbakken@gmail.com>2015-12-14 13:21:32 -0800
committerDaniel Stenberg <daniel@haxx.se>2015-12-14 23:14:39 +0100
commit8fbaf6749a53f07d4594f86ad95b06bb7186716a (patch)
tree67bcb2d27529e229e4570b47cd0e8b65bf0081a5
parent63a5a756a849b86b9a78430e03b22260708cd9f5 (diff)
setstropt: const-correctness
Closes #565
-rw-r--r--lib/url.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/url.c b/lib/url.c
index 5a83207da..d3520141a 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -296,7 +296,7 @@ void Curl_freeset(struct SessionHandle *data)
data->change.url = NULL;
}
-static CURLcode setstropt(char **charp, char *s)
+static CURLcode setstropt(char **charp, const char *s)
{
/* Release the previous storage at `charp' and replace by a dynamic storage
copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */
@@ -304,12 +304,12 @@ static CURLcode setstropt(char **charp, char *s)
Curl_safefree(*charp);
if(s) {
- s = strdup(s);
+ char *str = strdup(s);
- if(!s)
+ if(!str)
return CURLE_OUT_OF_MEMORY;
- *charp = s;
+ *charp = str;
}
return CURLE_OK;
@@ -572,31 +572,31 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
set->socks5_gssapi_nec = FALSE;
/* set default GSS-API service name */
result = setstropt(&set->str[STRING_SOCKS5_GSSAPI_SERVICE],
- (char *) CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE);
+ CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE);
if(result)
return result;
/* set default negotiate proxy service name */
result = setstropt(&set->str[STRING_PROXY_SERVICE_NAME],
- (char *) CURL_DEFAULT_PROXY_SERVICE_NAME);
+ CURL_DEFAULT_PROXY_SERVICE_NAME);
if(result)
return result;
/* set default negotiate service name */
result = setstropt(&set->str[STRING_SERVICE_NAME],
- (char *) CURL_DEFAULT_SERVICE_NAME);
+ CURL_DEFAULT_SERVICE_NAME);
if(result)
return result;
#endif
/* This is our preferred CA cert bundle/path since install time */
#if defined(CURL_CA_BUNDLE)
- result = setstropt(&set->str[STRING_SSL_CAFILE], (char *) CURL_CA_BUNDLE);
+ result = setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE);
if(result)
return result;
#endif
#if defined(CURL_CA_PATH)
- result = setstropt(&set->str[STRING_SSL_CAPATH], (char *) CURL_CA_PATH);
+ result = setstropt(&set->str[STRING_SSL_CAPATH], CURL_CA_PATH);
if(result)
return result;
#endif
@@ -936,7 +936,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
argptr = va_arg(param, char *);
result = setstropt(&data->set.str[STRING_ENCODING],
(argptr && !*argptr)?
- (char *) ALL_CONTENT_ENCODINGS: argptr);
+ ALL_CONTENT_ENCODINGS: argptr);
break;
case CURLOPT_TRANSFER_ENCODING: