diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-09 00:03:42 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-09 00:03:42 +0300 |
commit | 62b5f42d8174e49bc219e5231d4fc9503ece4131 (patch) | |
tree | 77f04b1a2af0c4667e5ef3194b2717a7a0047f67 /py/runtime.c | |
parent | ffae48d7507d398806bd935b054b7ca19bc01161 (diff) | |
parent | 01d6be4d512118d39ef52f79ca9ddddd2bba3f32 (diff) | |
download | micropython-62b5f42d8174e49bc219e5231d4fc9503ece4131.tar.gz micropython-62b5f42d8174e49bc219e5231d4fc9503ece4131.zip |
Merge pull request #568 from stinos/windows-msvc-port
Windows MS Visual C port
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 a5a5bc5a4a..7a701fec57 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); |