[PATCH x11spice] Use C99 struct initializiers instead of memset for local structures.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx>
---
 src/gui.c    | 3 +--
 src/listen.c | 3 +--
 src/main.c   | 4 +---
 src/spice.c  | 3 +--
 4 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/gui.c b/src/gui.c
index 6748f66e..88acf5c9 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -147,10 +147,9 @@ void session_disconnect_client(session_t *session)
 int main(int argc, char *argv[])
 {
     gui_t gui;
-    session_t session;
+    session_t session = { 0 };
 
     setlocale(LC_ALL, "");
-    memset(&session, 0, sizeof(session));
     gui_create(&gui, &session, argc, argv);
     gui_run(&gui);
     gui_destroy(&gui);
diff --git a/src/listen.c b/src/listen.c
index 1bddf7ed..452fd81f 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -117,11 +117,10 @@ int listen_parse(const char *listen_spec, char **addr, int *port_start, int *por
 static int try_port(const char *addr, int port)
 {
     static const int on = 1, off = 0;
-    struct addrinfo ai, *res, *e;
+    struct addrinfo ai = { 0 }, *res, *e;
     char portbuf[33];
     int sock, rc;
 
-    memset(&ai, 0, sizeof(ai));
     ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
     ai.ai_socktype = SOCK_STREAM;
     ai.ai_family = 0;
diff --git a/src/main.c b/src/main.c
index 7f321af9..f18311c9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
 {
     int rc;
 
-    session_t session;
+    session_t session = { 0 };
 
     int display_opened = 0;
     int spice_started = 0;
@@ -63,8 +63,6 @@ int main(int argc, char *argv[])
     int session_created = 0;
     int session_started = 0;
 
-    memset(&session, 0, sizeof(session));
-
     /*------------------------------------------------------------------------
     **  Parse arguments
     **----------------------------------------------------------------------*/
diff --git a/src/spice.c b/src/spice.c
index d9666441..430df405 100644
--- a/src/spice.c
+++ b/src/spice.c
@@ -474,9 +474,8 @@ static int send_monitors_config(spice_t *s, int w, int h)
 
 int spice_create_primary(spice_t *s, int w, int h, int bytes_per_line, void *shmaddr)
 {
-    QXLDevSurfaceCreate surface;
+    QXLDevSurfaceCreate surface = { 0 };
 
-    memset(&surface, 0, sizeof(surface));
     surface.height = h;
     surface.width = w;
 
-- 
2.11.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]