[Spice-commits] 3 commits - server/dispatcher.c server/display-channel.c server/stat-file.c server/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 25 12:14:32 UTC 2018


 server/dispatcher.c      |    2 +-
 server/display-channel.c |    2 +-
 server/stat-file.c       |    5 ++---
 server/tests/replay.c    |    2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 486aea984bb584602427425ea2edc8c53abb0de3
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sun Jun 24 17:09:55 2018 +0100

    stat-file: Exit earlier to reduce indentation
    
    Just style change. Invert the if to exit earlier.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe de Dinechin <dinechin at redhat.com>

diff --git a/server/stat-file.c b/server/stat-file.c
index 45dece65..b2c199f3 100644
--- a/server/stat-file.c
+++ b/server/stat-file.c
@@ -154,12 +154,11 @@ stat_file_add_node(RedStatFile *stat_file, StatNodeRef parent, const char *name,
                                         stat_file->stat->nodes[parent].first_child_index);
     while (ref != INVALID_STAT_REF) {
         node = &stat_file->stat->nodes[ref];
-        if (strcmp(name, node->name)) {
-            ref = node->next_sibling_index;
-        } else {
+        if (strcmp(name, node->name) == 0) {
             pthread_mutex_unlock(&stat_file->lock);
             return ref;
         }
+        ref = node->next_sibling_index;
     }
     for (ref = 0; ref < stat_file->max_nodes; ref++) {
         node = &stat_file->stat->nodes[ref];
commit d701fac78fc418e4aeb9e25ad2fcd0035e80b1fe
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jun 20 14:23:44 2018 +0100

    dispatcher: Define pollfd variable only if needed
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe de Dinechin <dinechin at redhat.com>

diff --git a/server/dispatcher.c b/server/dispatcher.c
index 301feffd..3e0decde 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -190,13 +190,13 @@ static int read_safe(int fd, uint8_t *buf, size_t size, int block)
 {
     int read_size = 0;
     int ret;
-    struct pollfd pollfd = {.fd = fd, .events = POLLIN, .revents = 0};
 
     if (size == 0) {
         return 0;
     }
 
     if (!block) {
+        struct pollfd pollfd = {.fd = fd, .events = POLLIN, .revents = 0};
         while ((ret = poll(&pollfd, 1, 0)) == -1) {
             if (errno == EINTR) {
                 spice_debug("EINTR in poll");
commit 9663ae6785d55243a0f66a0109a364deb99fb22a
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jun 20 11:18:46 2018 +0100

    Do not use bzero
    
    Not defined in MingW.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe de Dinechin <dinechin at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index 5f2e866f..b5e4b61d 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1627,7 +1627,7 @@ static Drawable *display_channel_drawable_try_new(DisplayChannel *display,
             return NULL;
     }
 
-    bzero(drawable, sizeof(Drawable));
+    memset(drawable, 0, sizeof(Drawable));
     /* Pointer to the display from which the drawable is allocated.  This
      * pointer is safe to be retained as DisplayChannel lifespan is bigger than
      * all drawables.  */
diff --git a/server/tests/replay.c b/server/tests/replay.c
index 137f0606..a3379adc 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -96,7 +96,7 @@ static void set_compression_level(QXLInstance *qin, int level)
 
 static void get_init_info(QXLInstance *qin, QXLDevInitInfo *info)
 {
-    bzero(info, sizeof(*info));
+    memset(info, 0, sizeof(*info));
     info->num_memslots = 1;
     info->num_memslots_groups = 1;
     info->memslot_id_bits = 1;


More information about the Spice-commits mailing list