micropython/extmod
Damien George cf31d384f1 py/stream: Switch stream close operation from method to ioctl.
This patch moves the implementation of stream closure from a dedicated
method to the ioctl of the stream protocol, for each type that implements
closing.  The benefits of this are:

1. Rounds out the stream ioctl function, which already includes flush,
   seek and poll (among other things).

2. Makes calling mp_stream_close() on an object slightly more efficient
   because it now no longer needs to lookup the close method and call it,
   rather it just delegates straight to the ioctl function (if it exists).

3. Reduces code size and allows future types that implement the stream
   protocol to be smaller because they don't need a dedicated close method.

Code size reduction is around 200 bytes smaller for x86 archs and around
30 bytes smaller for the bare-metal archs.
2018-04-10 13:41:32 +10:00
..
crypto-algorithms extmod/crypto-algorithms/sha256: Remove non-standard memory.h header. 2017-04-27 15:01:01 +03:00
lwip-include all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
re1.5 extmod/re1.5: Upgrade to v0.8.2, adds hook for stack overflow checking. 2017-10-02 21:20:47 +03:00
uzlib extmod/uzlib: Update to upstream v2.1. 2016-10-11 07:13:23 +03:00
machine_i2c.c all: Convert remaining "mp_uint_t n_args" to "size_t n_args". 2017-08-30 10:59:58 +10:00
machine_i2c.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_mem.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
machine_mem.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
machine_pinbase.c extmod/machine_pinbase: Put PinBase singleton in ROM. 2017-09-12 16:00:21 +10:00
machine_pinbase.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_pulse.c extmod/machine_pulse: Make time_pulse_us() not throw exceptions. 2017-02-05 14:20:17 +03:00
machine_pulse.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_signal.c extmod/machine_signal: Change VLA to use new scoped allocation API. 2017-12-11 13:49:09 +11:00
machine_signal.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_spi.c drivers/bus: Pull out software SPI implementation to dedicated driver. 2018-03-10 00:59:43 +11:00
machine_spi.h drivers/bus: Pull out software SPI implementation to dedicated driver. 2018-03-10 00:59:43 +11:00
misc.h extmod/uos_dupterm: Update uos.dupterm() and helper funcs to have index. 2017-10-13 20:01:57 +11:00
modbtree.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
modframebuf.c extmod/modframebuf: Add 8-bit greyscale format (GS8). 2017-12-14 17:36:13 +11:00
modlwip.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
modonewire.c extmod/mod{lwip,onewire,webrepl}: Convert to mp_rom_map_elem_t. 2017-07-29 18:24:16 +03:00
modubinascii.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modubinascii.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
moductypes.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
moduhashlib.c extmod/moduhashlib: Enable SHA1 hashing when using "mbedtls" library. 2017-11-12 21:46:23 +02:00
moduheapq.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modujson.c extmod/modujson: Implement ujson.dump() function. 2018-02-15 11:35:42 +11:00
modurandom.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modure.c extmod/modure: Add cast to workaround bug in MSVC. 2017-12-13 22:22:57 +11:00
moduselect.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modussl_axtls.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
modussl_mbedtls.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
modutimeq.c all: Use NULL instead of "" when calling mp_raise exception helpers. 2017-10-24 22:39:36 +11:00
moduzlib.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modwebrepl.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
modwebsocket.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
modwebsocket.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
uos_dupterm.c extmod/uos_dupterm: Swallow any errors from dupterm closing the stream. 2017-10-19 14:10:17 +11:00
utime_mphal.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
utime_mphal.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
vfs_fat_diskio.c extmod/vfs_fat_diskio: Use a C-stack-allocated bytearray for block buf. 2018-02-28 15:11:20 +11:00
vfs_fat_file.c py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
vfs_fat.c extmod/vfs_fat: Add file size as 4th element of uos.ilistdir tuple. 2018-03-12 12:26:36 +11:00
vfs_fat.h extmod/vfs_fat: Remove declaration of mp_builtin_open_obj. 2018-02-23 17:41:47 +11:00
vfs_reader.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
vfs.c extmod/vfs_fat: Add file size as 4th element of uos.ilistdir tuple. 2018-03-12 12:26:36 +11:00
vfs.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
virtpin.c all: Rename mp_obj_type_t::stream_p to protocol. 2016-06-18 18:44:57 +03:00
virtpin.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00