diff options
-rw-r--r-- | docs/examples/ephiperfifo.c | 26 | ||||
-rw-r--r-- | docs/examples/hiperfifo.c | 36 |
2 files changed, 29 insertions, 33 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; } diff --git a/docs/examples/hiperfifo.c b/docs/examples/hiperfifo.c index a50522a8e..6f176365b 100644 --- a/docs/examples/hiperfifo.c +++ b/docs/examples/hiperfifo.c @@ -72,12 +72,6 @@ callback. #include <errno.h> #include <sys/cdefs.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 */ @@ -143,9 +137,10 @@ static void mcode_or_die(const char *where, CURLMcode code) /* Update the event timer after curl_multi library calls */ -static int multi_timer_cb(CURLM *multi _Unused, long timeout_ms, GlobalInfo *g) +static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) { struct timeval timeout; + (void)multi; timeout.tv_sec = timeout_ms/1000; timeout.tv_usec = (timeout_ms%1000)*1000; @@ -220,10 +215,12 @@ static void event_cb(int fd, short kind, void *userp) /* Called by libevent when our timeout expires */ -static void timer_cb(int fd _Unused, short kind _Unused, void *userp) +static void timer_cb(int fd, short kind, void *userp) { GlobalInfo *g = (GlobalInfo *)userp; CURLMcode rc; + (void)fd; + (void)kind; rc = curl_multi_socket_action(g->multi, CURL_SOCKET_TIMEOUT, 0, &g->still_running); @@ -303,22 +300,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; @@ -361,12 +357,14 @@ static void new_conn(char *url, GlobalInfo *g) } /* This gets called whenever data is received from the fifo */ -static void fifo_cb(int fd _Unused, short event _Unused, void *arg) +static void fifo_cb(int fd, short event, void *arg) { char s[1024]; long int rv = 0; int n = 0; GlobalInfo *g = (GlobalInfo *)arg; + (void)fd; + (void)event; do { s[0]='\0'; @@ -427,9 +425,11 @@ static void clean_fifo(GlobalInfo *g) unlink(fifo); } -int main(int argc _Unused, char **argv _Unused) +int main(int argc, char **argv) { GlobalInfo g; + (void)argc; + (void)argv; memset(&g, 0, sizeof(GlobalInfo)); g.evbase = event_base_new(); |