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

Victor Toso victortoso at redhat.com
Wed Feb 22 13:11:10 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;

As spice_util_get_debug() uses g_once(), this should not impact
performance or might improve it with one memory allocation less.

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 | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 651e438..8682229 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -604,6 +604,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
 {
     SpiceGtkSession *self = free_weak_ref(user_data);
 
+    SPICE_DEBUG("%s:", __FUNCTION__);
 
     if (self == NULL || atoms == NULL)
         return;
@@ -628,15 +629,6 @@ 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++) {
@@ -653,6 +645,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
                 }
                 if (types[t] == 0) {
                     /* add type to empty slot */
+                    SPICE_DEBUG("'%s'", name);
                     types[t] = atom2agent[m].vdagent;
                     num_types++;
                     break;
-- 
2.9.3



More information about the Spice-devel mailing list