]> granicus.if.org Git - libevent/commitdiff
Initialize variable to 0 replace use memset function in sample/hello-world.c
authoryangyongsheng <iysheng@163.com>
Sun, 29 Dec 2019 12:52:17 +0000 (20:52 +0800)
committeriysheng <iysheng@163.com>
Mon, 30 Dec 2019 02:09:15 +0000 (10:09 +0800)
sample/hello-world.c

index 2023cd6c6aa64031935de2d913251a2f564c8792..a13e06af612dd0cf949c621339495548b2a4a869 100644 (file)
@@ -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);