aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2019-05-20 11:50:23 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2019-05-21 09:47:03 +0200
commitb069815a7ac245c9c794c173de411f3d4d051531 (patch)
treee42298572ba8da3fc3f0485fca11c94489a051b8 /docs
parent528b284e4b145ff38c5ab87b4d6daa5d796fd938 (diff)
examples: remove unused variables
Fixes Codacy/CppCheck warnings. Closes
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/cacertinmem.c4
-rw-r--r--docs/examples/curlgtk.c3
-rw-r--r--docs/examples/curlx.c2
-rw-r--r--docs/examples/ephiperfifo.c4
-rw-r--r--docs/examples/evhiperfifo.c1
-rw-r--r--docs/examples/ghiper.c1
-rw-r--r--docs/examples/hiperfifo.c3
-rw-r--r--docs/examples/multithread.c11
-rw-r--r--docs/examples/sampleconv.c3
-rw-r--r--docs/examples/smooth-gtk-thread.c14
-rw-r--r--docs/examples/threaded-shared-conn.c4
-rw-r--r--docs/examples/threaded-ssl.c11
12 files changed, 26 insertions, 35 deletions
diff --git a/docs/examples/cacertinmem.c b/docs/examples/cacertinmem.c
index 9e15eb79d..071031707 100644
--- a/docs/examples/cacertinmem.c
+++ b/docs/examples/cacertinmem.c
@@ -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++;
}
}
diff --git a/docs/examples/curlgtk.c b/docs/examples/curlgtk.c
index 79e89acc6..35b60da63 100644
--- a/docs/examples/curlgtk.c
+++ b/docs/examples/curlgtk.c
@@ -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 */
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index 49f52e614..df4ab3fa2 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -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",
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c
index a8dda2a4e..a4b90fe4f 100644
--- a/docs/examples/ephiperfifo.c
+++ b/docs/examples/ephiperfifo.c
@@ -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;
}
diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c
index 6474e352c..38ea312be 100644
--- a/docs/examples/evhiperfifo.c
+++ b/docs/examples/evhiperfifo.c
@@ -421,7 +421,6 @@ static int init_fifo(GlobalInfo *g)
int main(int argc, char **argv)
{
GlobalInfo g;
- CURLMcode rc;
(void)argc;
(void)argv;
diff --git a/docs/examples/ghiper.c b/docs/examples/ghiper.c
index cb013afd4..e9d1fcea7 100644
--- a/docs/examples/ghiper.c
+++ b/docs/examples/ghiper.c
@@ -411,7 +411,6 @@ int init_fifo(void)
int main(int argc, char **argv)
{
GlobalInfo *g;
- CURLMcode rc;
GMainLoop*gmain;
int fd;
GIOChannel* ch;
diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c
index f3c1bbc73..c8e8bfdf1 100644
--- a/docs/examples/hiperfifo.c
+++ b/docs/examples/hiperfifo.c
@@ -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;
}
diff --git a/docs/examples/multithread.c b/docs/examples/multithread.c
index 83ed3f589..a162000da 100644
--- a/docs/examples/multithread.c
+++ b/docs/examples/multithread.c
@@ -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);
}
diff --git a/docs/examples/sampleconv.c b/docs/examples/sampleconv.c
index 7bfaa51c6..1c4aec61b 100644
--- a/docs/examples/sampleconv.c
+++ b/docs/examples/sampleconv.c
@@ -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);
diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c
index 5a4f18fd9..66d8c10b5 100644
--- a/docs/examples/smooth-gtk-thread.c
+++ b/docs/examples/smooth-gtk-thread.c
@@ -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);
}
diff --git a/docs/examples/threaded-shared-conn.c b/docs/examples/threaded-shared-conn.c
index e238b952e..2eda6239d 100644
--- a/docs/examples/threaded-shared-conn.c
+++ b/docs/examples/threaded-shared-conn.c
@@ -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);
}
diff --git a/docs/examples/threaded-ssl.c b/docs/examples/threaded-ssl.c
index adf46292a..522f8c49a 100644
--- a/docs/examples/threaded-ssl.c
+++ b/docs/examples/threaded-ssl.c
@@ -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);
}