summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorEmil Engler <me@emilengler.com>2021-04-02 21:02:12 +0200
committerAzat Khuzhin <azat@libevent.org>2021-04-03 12:50:00 +0300
commite77f18727478ff7f5d135a11bb96d6f42c82d127 (patch)
treee4ad1fcd8e4e2277b2e03f4bbd360370b1a7556d /sample
parent0ef0d9475c15d851d47d81dc70cf0b7bb73723ef (diff)
downloadlibevent-e77f18727478ff7f5d135a11bb96d6f42c82d127.tar.gz
sample: use unsigned short instead of int for port
The C standard gurantees that an unsigned short is at least up to 65535 huge. Enough to store every TCP port. Also the parameter PORT is overgiven to the `htons()` function which assumes that the parameter is of type `uint16_t` which unsigned short is on most platforms.
Diffstat (limited to 'sample')
-rw-r--r--sample/hello-world.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sample/hello-world.c b/sample/hello-world.c
index a13e06af..f3b9b4d6 100644
--- a/sample/hello-world.c
+++ b/sample/hello-world.c
@@ -27,7 +27,7 @@
static const char MESSAGE[] = "Hello, World!\n";
-static const int PORT = 9995;
+static const unsigned short PORT = 9995;
static void listener_cb(struct evconnlistener *, evutil_socket_t,
struct sockaddr *, int socklen, void *);