summaryrefslogtreecommitdiff
path: root/demo/http_client
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-02-14 14:50:04 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-14 18:28:36 -0800
commit45bc175ef9278c175d2fc3a0678b49b18e74c449 (patch)
treeb1838778ee898112f28b35178364068c6f48c9b4 /demo/http_client
parent8f93750ed2a6aaa1749eb689ddf119280f9aac7a (diff)
downloadnng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.gz
nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.bz2
nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.zip
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.
Diffstat (limited to 'demo/http_client')
-rw-r--r--demo/http_client/http_client.c26
1 files changed, 13 insertions, 13 deletions
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 <nng/nng.h>
#include <stdio.h>
#include <stdlib.h>
-#include <nng/nng.h>
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.