From 01d6be4d512118d39ef52f79ca9ddddd2bba3f32 Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 5 May 2014 12:18:27 +0200 Subject: Windows MSVC port Extend the windows port so it compiles with the toolchain from Visual Studio 2013 --- py/runtime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'py/runtime.c') diff --git a/py/runtime.c b/py/runtime.c index a5a5bc5a4..7a701fec5 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "mpconfig.h" #include "nlr.h" @@ -1074,11 +1075,12 @@ import_error: uint pkg_name_len; const char *pkg_name = mp_obj_str_get_data(dest[0], &pkg_name_len); - char dot_name[pkg_name_len + 1 + qstr_len(name)]; + const uint dot_name_len = pkg_name_len + 1 + qstr_len(name); + char *dot_name = alloca(dot_name_len); memcpy(dot_name, pkg_name, pkg_name_len); dot_name[pkg_name_len] = '.'; memcpy(dot_name + pkg_name_len + 1, qstr_str(name), qstr_len(name)); - qstr dot_name_q = qstr_from_strn(dot_name, sizeof(dot_name)); + qstr dot_name_q = qstr_from_strn(dot_name, dot_name_len); mp_obj_t args[5]; args[0] = MP_OBJ_NEW_QSTR(dot_name_q); -- cgit v1.2.3