summaryrefslogtreecommitdiff
path: root/py/stream.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-08-14 17:36:08 +1000
committerDamien George <damien.p.george@gmail.com>2018-08-14 17:36:08 +1000
commit9ab816d676543178773928053906fcb2c2c433f7 (patch)
tree50b55eba136e702f0ecac8b4a8f7d43995c70b92 /py/stream.h
parentab78fe0eb9997622e40d412d5f7d5e9b1a91e47a (diff)
py/stream: Adjust mp_stream_posix_XXX to take void*, not mp_obj_t.
These POSIX wrappers are assumed to be passed a concrete stream object so it is more efficient (eg on nan-boxing builds) to pass in the pointer rather than mp_obj_t, because then the users of these functions only need to store a void* (and mp_obj_t may be wider than a pointer). And things would be further improved if the stream protocol functions eventually took a pointer as their first argument (instead of an mp_obj_t). This patch is a step to getting ussl/axtls compiling on nan-boxing builds. See issue #3085.
Diffstat (limited to 'py/stream.h')
-rw-r--r--py/stream.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/py/stream.h b/py/stream.h
index be34176db..f4c6d30bd 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -116,10 +116,11 @@ void mp_stream_write_adaptor(void *self, const char *buf, size_t len);
#if MICROPY_STREAMS_POSIX_API
// Functions with POSIX-compatible signatures
-ssize_t mp_stream_posix_write(mp_obj_t stream, const void *buf, size_t len);
-ssize_t mp_stream_posix_read(mp_obj_t stream, void *buf, size_t len);
-off_t mp_stream_posix_lseek(mp_obj_t stream, off_t offset, int whence);
-int mp_stream_posix_fsync(mp_obj_t stream);
+// "stream" is assumed to be a pointer to a concrete object with the stream protocol
+ssize_t mp_stream_posix_write(void *stream, const void *buf, size_t len);
+ssize_t mp_stream_posix_read(void *stream, void *buf, size_t len);
+off_t mp_stream_posix_lseek(void *stream, off_t offset, int whence);
+int mp_stream_posix_fsync(void *stream);
#endif
#if MICROPY_STREAMS_NON_BLOCK