]> granicus.if.org Git - libevent/commitdiff
sample/http-connect: made it compatible with C90
authorAzat Khuzhin <a3at.mail@gmail.com>
Tue, 18 Aug 2015 18:29:03 +0000 (21:29 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Tue, 18 Aug 2015 18:29:03 +0000 (21:29 +0300)
sample/http-connect.c

index ca29260a403f2cc2d4bfa4f766037f2bfa3e158c..980b1ee23b04ae77e17010f89d2e7d2a43f50614 100644 (file)
@@ -14,13 +14,13 @@ struct connect_base
        struct evhttp_uri *location;
 };
 
-void get_cb(struct evhttp_request *req, void *arg)
+static void get_cb(struct evhttp_request *req, void *arg)
 {
        assert(req);
        evbuffer_write(req->input_buffer, STDOUT_FILENO);
 }
 
-void connect_cb(struct evhttp_request *proxy_req, void *arg)
+static void connect_cb(struct evhttp_request *proxy_req, void *arg)
 {
        char buffer[PATH_MAX];
 
@@ -49,6 +49,8 @@ int main(int argc, const char **argv)
        struct evhttp_connection *evcon;
        struct evhttp_request *req;
 
+       struct connect_base connect_base;
+
        if (argc != 3) {
                printf("Usage: %s proxy url\n", argv[0]);
                return 1;
@@ -80,7 +82,7 @@ int main(int argc, const char **argv)
        assert(base = event_base_new());
        assert(evcon = evhttp_connection_base_new(base, NULL,
                evhttp_uri_get_host(proxy), evhttp_uri_get_port(proxy)));
-       struct connect_base connect_base = {
+       connect_base = (struct connect_base){
                .evcon = evcon,
                .location = location,
        };