[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 15/220: examples: Avoid reserved names in hiperfifo
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 15/220: examples: Avoid reserved names in hiperfifo examples |
Date: |
Thu, 12 Sep 2019 17:26:15 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit fd5ab4358f09fafc83fc82ffd88c2c0b1c534c15
Author: Brad Spencer <address@hidden>
AuthorDate: Thu Jul 18 15:25:25 2019 -0300
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
---
docs/examples/ephiperfifo.c | 26 +++++++++++---------------
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();
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 12/220: multi: call detach_connection before Curl_disconnect, (continued)
- [GNUnet-SVN] [gnurl] 12/220: multi: call detach_connection before Curl_disconnect, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 13/220: ssh-libssh: do not specify O_APPEND when not in append mode, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 20/220: http2_recv: trigger another read when the last data is returned, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 19/220: curl: avoid uncessary libcurl timeouts (in parallel mode), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 16/220: easy: resize receive buffer on easy handle reset, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 26/220: mailmap: Amit Katyal, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 25/220: asyn-thread: removed unused variable, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 23/220: asyn-thread: create a socketpair to wait on, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 18/220: HTTP: use chunked Transfer-Encoding for HTTP_POST if size unknown, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 24/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 15/220: examples: Avoid reserved names in hiperfifo examples,
gnunet <=
- [GNUnet-SVN] [gnurl] 14/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 21/220: progress: reset download/uploaded counter, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 22/220: curl: cap the maximum allowed values for retry time arguments, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 04/220: docs/MANUAL.md: converted to markdown from plain text, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 09/220: HTTP3: initial (experimental) support, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 05/220: curl: support parallel transfers, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 31/220: ntlm: explicit type casting, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 38/220: mailmap: add Giorgos Oikonomou, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 33/220: getenv: support up to 4K environment variable contents on windows, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 37/220: src/makefile: fix uncompressed hugehelp.c generation, gnunet, 2019/09/12