From ad46c0592b2b24f39d5c37dbbfe1d79c81306f55 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Sat, 6 Jan 2018 14:38:34 +0800 Subject: [PATCH] Optimize code Signed-off-by: Jianhui Zhao --- example/helloworld.c | 2 +- src/uhttpd.c | 4 ++-- src/uhttpd.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/helloworld.c b/example/helloworld.c index d95b543..79e0662 100755 --- a/example/helloworld.c +++ b/example/helloworld.c @@ -19,7 +19,7 @@ //#define EXAMPLE_SSL -#define port "8000" +#define port 8000 static void hello_action(struct uh_client *cl) { diff --git a/src/uhttpd.c b/src/uhttpd.c index d026f28..0f3ece9 100755 --- a/src/uhttpd.c +++ b/src/uhttpd.c @@ -57,12 +57,12 @@ static void uh_accept_cb(struct uloop_fd *fd, unsigned int events) uh_accept_client(srv, srv->ssl); } -struct uh_server *uh_server_new(const char *host, const char *port) +struct uh_server *uh_server_new(const char *host, int port) { struct uh_server *srv = NULL; int sock = -1; - sock = usock(USOCK_TCP | USOCK_SERVER | USOCK_IPV4ONLY, host, port); + sock = usock(USOCK_TCP | USOCK_SERVER | USOCK_IPV4ONLY, host, usock_port(port)); if (sock < 0) { uh_log_err("usock"); return NULL; diff --git a/src/uhttpd.h b/src/uhttpd.h index 3c99288..2fd26d3 100755 --- a/src/uhttpd.h +++ b/src/uhttpd.h @@ -41,6 +41,6 @@ struct uh_server { #endif }; -struct uh_server *uh_server_new(const char *host, const char *port); +struct uh_server *uh_server_new(const char *host, int port); #endif