From 4d3aa827f633669c2e911ed50c8a00c9a37c62f7 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 21 Jul 2017 15:58:38 +0800 Subject: [PATCH] tests/rendernode-create-tests.c: Don't use VLAs Replace uses of VLAs (variable-length arrays) using g_newa(), since Visual Studio builds will unlikely ever support VLAs (which became optional in C11). https://bugzilla.gnome.org/show_bug.cgi?id=773299 --- tests/rendernode-create-tests.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/rendernode-create-tests.c b/tests/rendernode-create-tests.c index b55e76816e..98ab102f4f 100644 --- a/tests/rendernode-create-tests.c +++ b/tests/rendernode-create-tests.c @@ -1,6 +1,7 @@ #include #include +#include static void hsv_to_rgb (GdkRGBA *rgba, @@ -80,7 +81,7 @@ hsv_to_rgb (GdkRGBA *rgba, GskRenderNode * rounded_borders (guint n) { - GskRenderNode *nodes[n]; + GskRenderNode **nodes = g_newa (GskRenderNode *, n); GskRenderNode *container; GskRoundedRect outline; float widths[4]; @@ -114,7 +115,7 @@ rounded_borders (guint n) GskRenderNode * rounded_backgrounds (guint n) { - GskRenderNode *nodes[n]; + GskRenderNode **nodes = g_newa (GskRenderNode *, n); GskRenderNode *container, *texture; GskRoundedRect outline; GdkRGBA color; @@ -147,7 +148,7 @@ rounded_backgrounds (guint n) GskRenderNode * colors (guint n) { - GskRenderNode *nodes[10 * n]; + GskRenderNode **nodes = g_newa (GskRenderNode *, 10 * n); GskRenderNode *container; graphene_rect_t bounds; GdkRGBA color; @@ -175,7 +176,7 @@ colors (guint n) GskRenderNode * clipped_colors (guint n) { - GskRenderNode *nodes[n]; + GskRenderNode **nodes = g_newa (GskRenderNode *,n); GskRenderNode *container; graphene_rect_t bounds; GdkRGBA color; @@ -242,7 +243,7 @@ compare_color_stops (gconstpointer a, GskRenderNode * linear_gradient (guint n) { - GskRenderNode *nodes[n]; + GskRenderNode **nodes = g_newa (GskRenderNode *, n); GskRenderNode *container; graphene_rect_t bounds; GskColorStop stops[5]; @@ -307,7 +308,7 @@ linear_gradient (guint n) GskRenderNode * borders (guint n) { - GskRenderNode *nodes[n]; + GskRenderNode **nodes = g_newa (GskRenderNode *, n); GskRenderNode *container; GskRoundedRect outline; GdkRGBA colors[4];