[Spice-devel] [spice-gtk v2 5/7] gtk-session: move atom's debug

Victor Toso victortoso at redhat.com
Fri Feb 24 13:44:02 UTC 2017


From: Victor Toso <me at victortoso.com>

We already iterate in all n_atoms and get its name with
gdk_atom_name(), let's move the debug there too;

While at it, move the generic SPICE_DEBUG of the function to the top.
It should help us identify when the function was triggered but not
used due the early returns.

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-gtk-session.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index dc22674..d78b87c 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -604,6 +604,8 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
 {
     SpiceGtkSession *self = free_weak_ref(user_data);
 
+    SPICE_DEBUG("%s:", __FUNCTION__);
+
     if (self == NULL)
         return;
 
@@ -632,19 +634,13 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
         return;
     }
 
-    SPICE_DEBUG("%s:", __FUNCTION__);
-    if (spice_util_get_debug()) {
-        for (a = 0; a < n_atoms; a++) {
-            name = gdk_atom_name(atoms[a]);
-            SPICE_DEBUG(" \"%s\"", name);
-            g_free(name);
-        }
-    }
-
     /* Set all Atoms that matches our current protocol implementation */
     num_types = 0;
     for (a = 0; a < n_atoms; a++) {
         name = gdk_atom_name(atoms[a]);
+
+        SPICE_DEBUG(" \"%s\"", name);
+
         for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) {
             if (strcasecmp(name, atom2agent[m].xatom) != 0) {
                 continue;
-- 
2.9.3



More information about the Spice-devel mailing list