[Spice-devel] [spice-gtk 5/4] gtk-session: move var declaration to the top

Victor Toso victortoso at redhat.com
Wed May 24 12:32:43 UTC 2017


From: Victor Toso <me at victortoso.com>

Most of spice-gtk code tries to follow that. Doing this specifically
to the clipboard_get_targets() due to the recent previous changes in
this function.

This patch also takes the opportunity to remove the array
initialization of types[] which is not needed since 1b73ae3cf25bd4
"gtk-session: use clear variable for array's size"

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

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 33db3c8..337ba78 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -603,6 +603,11 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
                                   gpointer user_data)
 {
     SpiceGtkSession *self = free_weak_ref(user_data);
+    SpiceGtkSessionPrivate *s;
+    guint32 types[SPICE_N_ELEMENTS(atom2agent)];
+    gint num_types;
+    int a;
+    int selection;
 
     SPICE_DEBUG("%s:", __FUNCTION__);
 
@@ -616,12 +621,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
         return;
     }
 
-    SpiceGtkSessionPrivate *s = self->priv;
-    guint32 types[SPICE_N_ELEMENTS(atom2agent)] = { 0 };
-    gint num_types;
-    int a;
-    int selection;
-
+    s = self->priv;
     if (s->main == NULL)
         return;
 
-- 
2.13.0



More information about the Spice-devel mailing list