diff options
author | Brad Spencer <bspencer@blackberry.com> | 2019-07-18 15:25:25 -0300 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2019-07-25 22:23:40 -0400 |
commit | fd5ab4358f09fafc83fc82ffd88c2c0b1c534c15 (patch) | |
tree | b7aa3247b4a940afe837b581f2090c739c51e25a /docs/examples/ephiperfifo.c | |
parent | 2741351a7bfa5cd9b58eba0f7afd6b41460368ea (diff) | |
download | curl-fd5ab4358f09fafc83fc82ffd88c2c0b1c534c15.tar.gz |
examples: Avoid reserved names in hiperfifo examples
- Trade in __attribute__((unused)) for the classic (void)x to silence
unused symbols.
Because the classic way is not gcc specific. Also because the prior
method mapped to symbol _Unused, which starts with _ and a capital
letter which is reserved.
Assisted-by: The Infinnovation team
Bug: https://github.com/curl/curl/issues/4120#issuecomment-512542108
Closes https://github.com/curl/curl/pull/4153
Diffstat (limited to 'docs/examples/ephiperfifo.c')
-rw-r--r-- | docs/examples/ephiperfifo.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/docs/examples/ephiperfifo.c b/docs/examples/ephiperfifo.c index bc4b0f057..657b61257 100644 --- a/docs/examples/ephiperfifo.c +++ b/docs/examples/ephiperfifo.c @@ -73,12 +73,6 @@ callback. #include <curl/curl.h> -#ifdef __GNUC__ -#define _Unused __attribute__((unused)) -#else -#define _Unused -#endif - #define MSG_OUT stdout /* Send info to stdout, change to stderr if you want */ @@ -336,22 +330,21 @@ static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) /* CURLOPT_WRITEFUNCTION */ -static size_t write_cb(void *ptr _Unused, size_t size, size_t nmemb, - void *data) +static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data) { - size_t realsize = size * nmemb; - (void)_Unused; + (void)ptr; (void)data; - - return realsize; + return size * nmemb; } /* CURLOPT_PROGRESSFUNCTION */ -static int prog_cb(void *p, double dltotal, double dlnow, double ult _Unused, - double uln _Unused) +static int prog_cb(void *p, double dltotal, double dlnow, double ult, + double uln) { ConnInfo *conn = (ConnInfo *)p; + (void)ult; + (void)uln; fprintf(MSG_OUT, "Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal); return 0; @@ -469,12 +462,14 @@ void SignalHandler(int signo) } } -int main(int argc _Unused, char **argv _Unused) +int main(int argc, char **argv) { GlobalInfo g; struct itimerspec its; struct epoll_event ev; struct epoll_event events[10]; + (void)argc; + (void)argv; g_should_exit_ = 0; signal(SIGINT, SignalHandler); @@ -547,5 +542,6 @@ int main(int argc _Unused, char **argv _Unused) fflush(MSG_OUT); curl_multi_cleanup(g.multi); + clean_fifo(&g); return 0; } |