summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-13 12:52:39 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-13 12:52:39 +0100
commit640e7e4779d5d6b5e53fa305e5fe824da7783090 (patch)
treec299b3caf77aca8923a6fdb5554dd5a27ffc4c4e /unix/main.c
parentf95c68e53638aa363797595b0d618bbe08c56bb3 (diff)
parent4165cd1c0cfc4eabf446be504787090be84a421b (diff)
downloadmicropython-640e7e4779d5d6b5e53fa305e5fe824da7783090.tar.gz
micropython-640e7e4779d5d6b5e53fa305e5fe824da7783090.zip
Merge pull request #476 from pfalcon/static-sys
Convert sys module to static allocation
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/unix/main.c b/unix/main.c
index f18e40a7fa..e582244b39 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -42,7 +42,6 @@ long heap_size = 128*1024 * (sizeof(machine_uint_t) / 4);
// Stack top at the start of program
void *stack_top;
-void file_init();
void microsocket_init();
void time_init();
void ffi_init();
@@ -326,7 +325,7 @@ int main(int argc, char **argv) {
p++;
}
}
- mp_sys_path = mp_obj_new_list(path_num, NULL);
+ mp_obj_list_init(mp_sys_path, path_num);
mp_obj_t *path_items;
mp_obj_list_get(mp_sys_path, &path_num, &path_items);
path_items[0] = MP_OBJ_NEW_QSTR(MP_QSTR_);
@@ -348,10 +347,7 @@ int main(int argc, char **argv) {
p = p1 + 1;
}
- mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys);
- mp_store_attr(m_sys, MP_QSTR_path, mp_sys_path);
- mp_obj_t py_argv = mp_obj_new_list(0, NULL);
- mp_store_attr(m_sys, MP_QSTR_argv, py_argv);
+ mp_obj_list_init(mp_sys_argv, 0);
mp_store_name(qstr_from_str("test"), test_obj_new(42));
mp_store_name(qstr_from_str("mem_info"), mp_make_function_n(0, mem_info));
@@ -360,7 +356,6 @@ int main(int argc, char **argv) {
mp_store_name(qstr_from_str("gc"), (mp_obj_t)&pyb_gc_obj);
#endif
- file_init();
microsocket_init();
#if MICROPY_MOD_TIME
time_init();
@@ -418,7 +413,7 @@ int main(int argc, char **argv) {
free(basedir);
for (int i = a; i < argc; i++) {
- mp_obj_list_append(py_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
+ mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
}
do_file(argv[a]);
executed = true;