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:
committed by
Robert Fancsik
parent
051febfed7
commit
9c7511221f
@@ -26,7 +26,7 @@ static jerry_value_t
|
||||
get_canonical_name (const jerry_value_t name)
|
||||
{
|
||||
jerry_size_t name_size = jerry_get_string_size (name);
|
||||
jerry_char_t name_string[name_size + 1];
|
||||
JERRY_VLA (jerry_char_t, name_string, name_size + 1);
|
||||
jerry_string_to_char_buffer (name, name_string, name_size);
|
||||
name_string[name_size] = 0;
|
||||
|
||||
@@ -48,7 +48,7 @@ static bool
|
||||
resolve (const jerry_value_t canonical_name, jerry_value_t *result)
|
||||
{
|
||||
jerry_size_t name_size = jerry_get_string_size (canonical_name);
|
||||
jerry_char_t name_string[name_size + 1];
|
||||
JERRY_VLA (jerry_char_t, name_string, name_size + 1);
|
||||
jerry_string_to_char_buffer (canonical_name, name_string, name_size);
|
||||
name_string[name_size] = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user