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>
This commit is contained in:
Sven Wegener 2014-11-05 21:02:33 +01:00 committed by Damien George
parent 98d8d59c33
commit 238ab5013b
1 changed files with 6 additions and 4 deletions

View File

@ -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) {
// extract the list of paths
mp_uint_t path_num = 0;
mp_obj_t *path_items;
#if MICROPY_PY_SYS
// extract the list of paths
mp_uint_t path_num;
mp_obj_t *path_items;
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) {