unix/file: Use generic stream flush() method.
This commit is contained in:
parent
aa4ada943a
commit
64da62ec2e
10
unix/file.c
10
unix/file.c
|
@ -129,14 +129,6 @@ STATIC mp_uint_t fdfile_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, i
|
|||
}
|
||||
}
|
||||
|
||||
STATIC mp_obj_t fdfile_flush(mp_obj_t self_in) {
|
||||
mp_obj_fdfile_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_fd_is_open(self);
|
||||
fsync(self->fd);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_flush_obj, fdfile_flush);
|
||||
|
||||
STATIC mp_obj_t fdfile_close(mp_obj_t self_in) {
|
||||
mp_obj_fdfile_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
close(self->fd);
|
||||
|
@ -237,7 +229,7 @@ STATIC const mp_rom_map_elem_t rawfile_locals_dict_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_seek), MP_ROM_PTR(&mp_stream_seek_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_tell), MP_ROM_PTR(&mp_stream_tell_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&fdfile_flush_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&mp_stream_flush_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&fdfile_close_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&fdfile___exit___obj) },
|
||||
|
|
Loading…
Reference in New Issue