diff options
| author | stijn | 2014-05-05 12:18:27 +0200 |
|---|---|---|
| committer | stijn | 2014-05-08 10:06:43 +0200 |
| commit | 01d6be4d512118d39ef52f79ca9ddddd2bba3f32 (patch) | |
| tree | e409a3f5397df34518027a2ce5f62065196f82d7 /py/runtime.c | |
| parent | c1c32d65af038ba1b2a2a8dd69e3f7e63eac5f3e (diff) | |
Windows MSVC port
Extend the windows port so it compiles with the toolchain from Visual Studio 2013
Diffstat (limited to 'py/runtime.c')
| -rw-r--r-- | py/runtime.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 <stdio.h> #include <string.h> #include <assert.h> +#include <alloca.h> #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); |
