micropython/ports
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
..
bare-arm
cc3200 py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
esp32 py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
esp8266
minimal
pic16bit
qemu-arm
stm32 py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
teensy
unix py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00
windows
zephyr py/stream: Switch stream close operation from method to ioctl. 2018-04-10 13:41:32 +10:00