[gtk/wip/fanc999/gtk-3-24-meson-msvc: 31/31] tests/: Declare variables at the top-of-block



commit d437ba03d1ea46bd00323efaa36213a9c99e6657
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Mar 13 13:06:04 2019 +0800

    tests/: Declare variables at the top-of-block
    
    This will ensure that the code will build for pre-C99 compilers.

 tests/testbaseline.c   | 6 +++---
 tests/testspinbutton.c | 3 ++-
 tests/video-timer.c    | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/tests/testbaseline.c b/tests/testbaseline.c
index 3e6965bfaa..a9581f727a 100644
--- a/tests/testbaseline.c
+++ b/tests/testbaseline.c
@@ -99,12 +99,12 @@ main (int    argc,
 
   for (j = 0; j < 2; j++)
     {
-      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
-      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
-
       char *aligns_names[] = { "FILL", "BASELINE" };
       GtkAlign aligns[] = { GTK_ALIGN_FILL, GTK_ALIGN_BASELINE};
 
+      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+      gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 5);
+
       label = gtk_label_new (aligns_names[j]);
       gtk_container_add (GTK_CONTAINER (hbox), label);
 
diff --git a/tests/testspinbutton.c b/tests/testspinbutton.c
index 14eafdff47..d0925335d0 100644
--- a/tests/testspinbutton.c
+++ b/tests/testspinbutton.c
@@ -56,12 +56,13 @@ prepare_window_for_orientation (GtkOrientation orientation)
                                                0.0);
 
       GtkWidget *spin = gtk_spin_button_new (adj, 1.0, 0);
+      GtkWidget *hbox;
       gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), orientation);
       gtk_widget_set_halign (GTK_WIDGET (spin), GTK_ALIGN_CENTER);
 
       g_object_bind_property (wrap_button, "active", spin, "wrap", G_BINDING_SYNC_CREATE);
 
-      GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
+      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
       gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 2);
       gtk_container_add (GTK_CONTAINER (mainbox), hbox);
     }
diff --git a/tests/video-timer.c b/tests/video-timer.c
index bc5de1e5fe..cd137eec60 100644
--- a/tests/video-timer.c
+++ b/tests/video-timer.c
@@ -237,11 +237,12 @@ collect_old_frames (void)
   for (l = past_frames; l; l = l_next)
     {
       FrameData *frame_data = l->data;
+      GdkFrameTimings *timings;
       gboolean remove = FALSE;
       l_next = l->next;
 
-      GdkFrameTimings *timings = gdk_frame_clock_get_timings (frame_clock,
-                                                              frame_data->frame_counter);
+      timings = gdk_frame_clock_get_timings (frame_clock,
+                                             frame_data->frame_counter);
       if (timings == NULL)
         {
           remove = TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]