1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

curl_share_setopt: use va_end()

As spotted by Coverity, va_end() was not used previously. To make it
used I took away a bunch of return statements and made them into
assignments instead.
This commit is contained in:
Daniel Stenberg 2012-06-15 22:37:19 +02:00
parent ac3e356c95
commit 3da2c0f6d2

View File

@ -51,6 +51,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
curl_lock_function lockfunc;
curl_unlock_function unlockfunc;
void *ptr;
CURLSHcode res = CURLSHE_OK;
if(share->dirty)
/* don't allow setting options while one or more handles are already
@ -69,7 +70,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
if(!share->hostcache) {
share->hostcache = Curl_mk_dnscache();
if(!share->hostcache)
return CURLSHE_NOMEM;
res = CURLSHE_NOMEM;
}
break;
@ -78,12 +79,12 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
if(!share->cookies) {
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
if(!share->cookies)
return CURLSHE_NOMEM;
res = CURLSHE_NOMEM;
}
break;
#else /* CURL_DISABLE_HTTP */
return CURLSHE_NOT_BUILT_IN;
res = CURLSHE_NOT_BUILT_IN;
#endif
break;
case CURL_LOCK_DATA_SSL_SESSION:
#ifdef USE_SSL
@ -93,17 +94,18 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
sizeof(struct curl_ssl_session));
share->sessionage = 0;
if(!share->sslsession)
return CURLSHE_NOMEM;
res = CURLSHE_NOMEM;
}
break;
#else
return CURLSHE_NOT_BUILT_IN;
res = CURLSHE_NOT_BUILT_IN;
#endif
break;
case CURL_LOCK_DATA_CONNECT: /* not supported (yet) */
break;
default:
return CURLSHE_BAD_OPTION;
res = CURLSHE_BAD_OPTION;
}
break;
@ -125,24 +127,25 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
Curl_cookie_cleanup(share->cookies);
share->cookies = NULL;
}
break;
#else /* CURL_DISABLE_HTTP */
return CURLSHE_NOT_BUILT_IN;
res = CURLSHE_NOT_BUILT_IN;
#endif
break;
case CURL_LOCK_DATA_SSL_SESSION:
#ifdef USE_SSL
Curl_safefree(share->sslsession);
break;
#else
return CURLSHE_NOT_BUILT_IN;
res = CURLSHE_NOT_BUILT_IN;
#endif
break;
case CURL_LOCK_DATA_CONNECT:
break;
default:
return CURLSHE_BAD_OPTION;
res = CURLSHE_BAD_OPTION;
break;
}
break;
@ -162,10 +165,13 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
break;
default:
return CURLSHE_BAD_OPTION;
res = CURLSHE_BAD_OPTION;
break;
}
return CURLSHE_OK;
va_end(param);
return res;
}
CURLSHcode