From 45bc175ef9278c175d2fc3a0678b49b18e74c449 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 14 Feb 2018 14:50:04 -0800 Subject: fixes #234 Investigate enabling more verbose compiler warnings We enabled verbose compiler warnings, and found a lot of issues. Some of these were even real bugs. As a bonus, we actually save some initialization steps in the compat layer, and avoid passing some variables we don't need. --- demo/http_client/http_client.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'demo') diff --git a/demo/http_client/http_client.c b/demo/http_client/http_client.c index e3353ef8..522c1cd1 100644 --- a/demo/http_client/http_client.c +++ b/demo/http_client/http_client.c @@ -31,11 +31,11 @@ // % export CC="cc" // % ${CC} ${CPPFLAGS} http_client.c -o http_client ${LDFLAGS} // % ./http_client http://httpbin.org/ip -// +// +#include #include #include -#include void fatal(int rv) @@ -48,16 +48,16 @@ int main(int argc, char **argv) { nng_http_client *client; - nng_http_conn *conn; - nng_url *url; - nng_aio *aio; - nng_http_req *req; - nng_http_res *res; - const char *hdr; - int rv; - int len; - void *data; - nng_iov iov; + nng_http_conn * conn; + nng_url * url; + nng_aio * aio; + nng_http_req * req; + nng_http_res * res; + const char * hdr; + int rv; + int len; + void * data; + nng_iov iov; if (argc < 2) { fprintf(stderr, "No URL supplied!\n"); @@ -116,12 +116,12 @@ main(int argc, char **argv) exit(1); } + len = atoi(hdr); if (len == 0) { return (0); } // Allocate a buffer to receive the body data. - len = atoi(hdr); data = malloc(len); // Set up a single iov to point to the buffer. -- cgit v1.2.3-70-g09d2