From: yangyongsheng Date: Sun, 29 Dec 2019 12:52:17 +0000 (+0800) Subject: Initialize variable to 0 replace use memset function in sample/hello-world.c X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1edb6f6188d5dd2155c6e8ad997eaca11157e95f;p=libevent Initialize variable to 0 replace use memset function in sample/hello-world.c --- diff --git a/sample/hello-world.c b/sample/hello-world.c index 2023cd6c..a13e06af 100644 --- a/sample/hello-world.c +++ b/sample/hello-world.c @@ -42,7 +42,7 @@ main(int argc, char **argv) struct evconnlistener *listener; struct event *signal_event; - struct sockaddr_in sin; + struct sockaddr_in sin = {0}; #ifdef _WIN32 WSADATA wsa_data; WSAStartup(0x0201, &wsa_data); @@ -54,7 +54,6 @@ main(int argc, char **argv) return 1; } - memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = htons(PORT);