summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2014-11-05 21:02:33 +0100
committerDamien George <damien.p.george@gmail.com>2014-11-05 22:52:51 +0000
commit238ab5013bde2a2ccb03ab39f57b26a485013a95 (patch)
treee47af073358c13550b995dd66406dd2e39c85335 /py
parent98d8d59c33563f7a8306ac86c185dc1a2c43dce9 (diff)
downloadmicropython-238ab5013bde2a2ccb03ab39f57b26a485013a95.tar.gz
micropython-238ab5013bde2a2ccb03ab39f57b26a485013a95.zip
py: Deactivate more code without MICROPY_PY_SYS
When compiler optimization has been turned on, gcc knows that this code block is not going to be executed. But with -O0 it complains about path_items being used uninitialized. Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Diffstat (limited to 'py')
-rw-r--r--py/builtinimport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index f1288744a8..7ecf0919b2 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -77,17 +77,18 @@ STATIC mp_import_stat_t stat_dir_or_file(vstr_t *path) {
}
STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *dest) {
+#if MICROPY_PY_SYS
// extract the list of paths
- mp_uint_t path_num = 0;
+ mp_uint_t path_num;
mp_obj_t *path_items;
-#if MICROPY_PY_SYS
mp_obj_list_get(mp_sys_path, &path_num, &path_items);
-#endif
if (path_num == 0) {
+#endif
// mp_sys_path is empty, so just use the given file name
vstr_add_strn(dest, file_str, file_len);
return stat_dir_or_file(dest);
+#if MICROPY_PY_SYS
} else {
// go through each path looking for a directory or file
for (mp_uint_t i = 0; i < path_num; i++) {
@@ -108,6 +109,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
// could not find a directory or file
return MP_IMPORT_STAT_NO_EXIST;
}
+#endif
}
STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {