diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-13 12:52:39 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-13 12:52:39 +0100 |
commit | 640e7e4779d5d6b5e53fa305e5fe824da7783090 (patch) | |
tree | c299b3caf77aca8923a6fdb5554dd5a27ffc4c4e /unix/file.c | |
parent | f95c68e53638aa363797595b0d618bbe08c56bb3 (diff) | |
parent | 4165cd1c0cfc4eabf446be504787090be84a421b (diff) | |
download | micropython-640e7e4779d5d6b5e53fa305e5fe824da7783090.tar.gz micropython-640e7e4779d5d6b5e53fa305e5fe824da7783090.zip |
Merge pull request #476 from pfalcon/static-sys
Convert sys module to static allocation
Diffstat (limited to 'unix/file.c')
-rw-r--r-- | unix/file.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/unix/file.c b/unix/file.c index fa7be791a4..a0a865a263 100644 --- a/unix/file.c +++ b/unix/file.c @@ -146,9 +146,6 @@ mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_open_obj, 1, 2, mp_builtin_open); -void file_init() { - mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys); - mp_store_attr(m_sys, MP_QSTR_stdin, fdfile_new(STDIN_FILENO)); - mp_store_attr(m_sys, MP_QSTR_stdout, fdfile_new(STDOUT_FILENO)); - mp_store_attr(m_sys, MP_QSTR_stderr, fdfile_new(STDERR_FILENO)); -} +const mp_obj_fdfile_t mp_sys_stdin_obj = { .base = {&rawfile_type}, .fd = STDIN_FILENO }; +const mp_obj_fdfile_t mp_sys_stdout_obj = { .base = {&rawfile_type}, .fd = STDOUT_FILENO }; +const mp_obj_fdfile_t mp_sys_stderr_obj = { .base = {&rawfile_type}, .fd = STDERR_FILENO }; |