mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
examples: remove unused variables
Fixes Codacy/CppCheck warnings. Closes
This commit is contained in:
parent
528b284e4b
commit
b069815a7a
@ -86,7 +86,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
||||
BIO *cbio = BIO_new_mem_buf(mypem, sizeof(mypem));
|
||||
X509_STORE *cts = SSL_CTX_get_cert_store((SSL_CTX *)sslctx);
|
||||
X509_INFO *itmp;
|
||||
int i, count = 0;
|
||||
int i;
|
||||
STACK_OF(X509_INFO) *inf;
|
||||
(void)curl;
|
||||
(void)parm;
|
||||
@ -106,11 +106,9 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
|
||||
itmp = sk_X509_INFO_value(inf, i);
|
||||
if(itmp->x509) {
|
||||
X509_STORE_add_cert(cts, itmp->x509);
|
||||
count++;
|
||||
}
|
||||
if(itmp->crl) {
|
||||
X509_STORE_add_crl(cts, itmp->crl);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ int my_progress_func(GtkWidget *bar,
|
||||
void *my_thread(void *ptr)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
FILE *outfile;
|
||||
gchar *url = ptr;
|
||||
|
||||
@ -62,7 +61,7 @@ void *my_thread(void *ptr)
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func);
|
||||
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_perform(curl);
|
||||
|
||||
fclose(outfile);
|
||||
/* always cleanup */
|
||||
|
@ -544,7 +544,7 @@ int main(int argc, char **argv)
|
||||
BIO_printf(p.errorbio, "%d %s %d\n", __LINE__, "curl_easy_perform",
|
||||
res = curl_easy_perform(p.curl));
|
||||
{
|
||||
int result = curl_easy_getinfo(p.curl, CURLINFO_CONTENT_TYPE, &response);
|
||||
curl_easy_getinfo(p.curl, CURLINFO_CONTENT_TYPE, &response);
|
||||
if(mimetypeaccept && p.verbose) {
|
||||
if(!strcmp(mimetypeaccept, response))
|
||||
BIO_printf(p.errorbio, "the response has a correct mimetype : %s\n",
|
||||
|
@ -148,7 +148,6 @@ static void timer_cb(GlobalInfo* g, int revents);
|
||||
static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
|
||||
{
|
||||
struct itimerspec its;
|
||||
CURLMcode rc;
|
||||
|
||||
fprintf(MSG_OUT, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
|
||||
|
||||
@ -341,7 +340,8 @@ static size_t write_cb(void *ptr _Unused, size_t size, size_t nmemb,
|
||||
void *data)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
ConnInfo *conn _Unused = (ConnInfo*) data;
|
||||
(void)_Unused;
|
||||
(void)data;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
@ -421,7 +421,6 @@ static int init_fifo(GlobalInfo *g)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GlobalInfo g;
|
||||
CURLMcode rc;
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
|
@ -411,7 +411,6 @@ int init_fifo(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GlobalInfo *g;
|
||||
CURLMcode rc;
|
||||
GMainLoop*gmain;
|
||||
int fd;
|
||||
GIOChannel* ch;
|
||||
|
@ -307,7 +307,8 @@ static size_t write_cb(void *ptr _Unused, size_t size, size_t nmemb,
|
||||
void *data)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
ConnInfo *conn _Unused = (ConnInfo*) data;
|
||||
(void)_Unused;
|
||||
(void)data;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
@ -69,16 +69,15 @@ int main(int argc, char **argv)
|
||||
{
|
||||
pthread_t tid[NUMT];
|
||||
int i;
|
||||
int error;
|
||||
|
||||
/* Must initialize libcurl before any threads are started */
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
int error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
@ -87,7 +86,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* now wait for all threads to terminate */
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
error = pthread_join(tid[i], NULL);
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,6 @@ static CURLcode my_conv_from_utf8_to_ebcdic(char *buffer, size_t length)
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
@ -104,7 +103,7 @@ int main(void)
|
||||
curl_easy_setopt(curl, CURLOPT_CONV_FROM_UTF8_FUNCTION,
|
||||
my_conv_from_utf8_to_ebcdic);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
@ -68,7 +68,6 @@ size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
void *pull_one_url(void *NaN)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
gchar *http;
|
||||
FILE *outfile;
|
||||
|
||||
@ -98,7 +97,7 @@ void *pull_one_url(void *NaN)
|
||||
j++; /* critical line */
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
curl_easy_perform(curl);
|
||||
|
||||
fclose(outfile);
|
||||
printf("fclose\n");
|
||||
@ -131,14 +130,13 @@ void *create_thread(void *progress_bar)
|
||||
{
|
||||
pthread_t tid[NUMT];
|
||||
int i;
|
||||
int error;
|
||||
|
||||
/* Make sure I don't create more threads than urls. */
|
||||
for(i = 0; i < NUMT && i < num_urls ; i++) {
|
||||
error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
NULL);
|
||||
int error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
NULL);
|
||||
if(0 != error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
@ -147,7 +145,7 @@ void *create_thread(void *progress_bar)
|
||||
|
||||
/* Wait for all threads to terminate. */
|
||||
for(i = 0; i < NUMT && i < num_urls; i++) {
|
||||
error = pthread_join(tid[i], NULL);
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,6 @@ int main(void)
|
||||
{
|
||||
pthread_t tid[NUM_THREADS];
|
||||
int i;
|
||||
int error;
|
||||
CURLSH *share;
|
||||
struct initurl url[NUM_THREADS];
|
||||
|
||||
@ -132,6 +131,7 @@ int main(void)
|
||||
init_locks();
|
||||
|
||||
for(i = 0; i< NUM_THREADS; i++) {
|
||||
int error;
|
||||
url[i].url = URL;
|
||||
url[i].share = share;
|
||||
url[i].threadno = i;
|
||||
@ -144,7 +144,7 @@ int main(void)
|
||||
|
||||
/* now wait for all threads to terminate */
|
||||
for(i = 0; i< NUM_THREADS; i++) {
|
||||
error = pthread_join(tid[i], NULL);
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,6 @@ int main(int argc, char **argv)
|
||||
{
|
||||
pthread_t tid[NUMT];
|
||||
int i;
|
||||
int error;
|
||||
(void)argc; /* we don't use any arguments in this example */
|
||||
(void)argv;
|
||||
|
||||
@ -145,10 +144,10 @@ int main(int argc, char **argv)
|
||||
init_locks();
|
||||
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
int error = pthread_create(&tid[i],
|
||||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
@ -157,7 +156,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* now wait for all threads to terminate */
|
||||
for(i = 0; i< NUMT; i++) {
|
||||
error = pthread_join(tid[i], NULL);
|
||||
pthread_join(tid[i], NULL);
|
||||
fprintf(stderr, "Thread %d terminated\n", i);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user