#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 */
/* 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;
}
}
-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);
fflush(MSG_OUT);
curl_multi_cleanup(g.multi);
+ clean_fifo(&g);
return 0;
}
#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 */
/* 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;
/* 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);
/* 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;
}
/* 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';
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();