[test] Avoid alloca use as clang complain

Fixes https://circleci.com/gh/harfbuzz/harfbuzz/108171 complain
This commit is contained in:
Ebrahim Byagowi 2019-08-29 14:55:54 +04:30 committed by GitHub
parent 875985cd48
commit 28620310b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -210,7 +210,7 @@ static void
test_hb_ot_color_palette_get_colors_v0 (void)
{
unsigned int num_colors = hb_ot_color_palette_get_colors (cpal_v0, 0, 0, NULL, NULL);
hb_color_t *colors = (hb_color_t*) alloca (num_colors * sizeof (hb_color_t));
hb_color_t *colors = (hb_color_t*) malloc (num_colors * sizeof (hb_color_t));
size_t colors_size = num_colors * sizeof(*colors);
g_assert_cmpint (num_colors, ==, 2);
@ -252,6 +252,8 @@ test_hb_ot_color_palette_get_colors_v0 (void)
g_assert_cmpint (num_colors, ==, 0);
assert_color_rgba (colors, 0, 0x44, 0x44, 0x44, 0x44); /* untouched */
assert_color_rgba (colors, 1, 0x44, 0x44, 0x44, 0x44); /* untouched */
free (colors);
}