[Spice-devel] [PATCH spice-gtk] SpiceWidget: limit scope of 'area' variable

Jonathon Jongsma jjongsma at redhat.com
Thu Jul 14 14:52:43 UTC 2016


'area' was being set within the 'else' branch, but was not actually
used. So just move the declaration of 'area' within the if statement
where it is actually used. This potentially avoids "set-but-not-used"
warnings when GDK_WINDOWING_X11 is not defined.
---
 src/spice-widget.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index c5353af..c7dd553 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1195,7 +1195,6 @@ static gboolean do_color_convert(SpiceDisplay *display, GdkRectangle *r)
 static void set_egl_enabled(SpiceDisplay *display, bool enabled)
 {
     SpiceDisplayPrivate *d = display->priv;
-    GtkWidget *area;
 
     if (egl_enabled(d) == enabled)
         return;
@@ -1205,12 +1204,11 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled)
         /* even though the function is marked as deprecated, it's the
          * only way I found to prevent glitches when the window is
          * resized. */
-        area = gtk_stack_get_child_by_name(d->stack, "draw-area");
+        GtkWidget *area = gtk_stack_get_child_by_name(d->stack, "draw-area");
         gtk_widget_set_double_buffered(GTK_WIDGET(area), !enabled);
     } else
 #endif
     {
-        area = gtk_stack_get_child_by_name(d->stack, "gl-area");
         gtk_stack_set_visible_child_name(d->stack,
                                          enabled ? "gl-area" : "draw-area");
     }
-- 
2.5.5



More information about the Spice-devel mailing list