Don't use VLA's in unit tests and API examples (#3002)

MSVC doesn't support C99 VLA (variable-length array).
Use fixed size arrays in API examples and use JERRY_VLA macro
in unit tests to make these tests buildable on Windows too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2019-08-06 13:01:01 +02:00
committed by Robert Fancsik
parent 051febfed7
commit 9c7511221f
10 changed files with 53 additions and 40 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ main (void)
jerry_size_t bar_symbol_string_size = jerry_get_string_size (bar_symbol_string);
TEST_ASSERT (bar_symbol_string_size == (sizeof (SYMBOL_DESCIPTIVE_STRING_BAR) - 1));
jerry_char_t str_buff[bar_symbol_string_size];
JERRY_VLA (jerry_char_t, str_buff, bar_symbol_string_size);
jerry_string_to_char_buffer (bar_symbol_string, str_buff, bar_symbol_string_size);
TEST_ASSERT (memcmp (str_buff, SYMBOL_DESCIPTIVE_STRING_BAR, sizeof (SYMBOL_DESCIPTIVE_STRING_BAR) - 1) == 0);