aboutsummaryrefslogtreecommitdiff
path: root/py/stream.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-08-31 21:42:39 +1000
committerDamien George <damien.p.george@gmail.com>2017-09-21 18:22:55 +1000
commit7885a425d78a5a2fa7da5099cdd547a35f5e69dd (patch)
treee1a5e5a5ee884143328b2373d873e29496836eaa /py/stream.c
parent96fd80db1306ed67ee967b888c1c03c136bff4fb (diff)
py/stream: Remove unnecessary checks for NULL return from vstr_add_len.
The vstr argument to the calls to vstr_add_len are dynamically allocated (ie fixed_buf=false) and so vstr_add_len will never return NULL. So there's no need to check for it. Any out-of-memory errors are raised by the call to m_renew in vstr_ensure_extra.
Diffstat (limited to 'py/stream.c')
-rw-r--r--py/stream.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/py/stream.c b/py/stream.c
index 0029a59a7..0adf0af06 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -141,9 +141,6 @@ STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte fl
mp_uint_t last_buf_offset = 0;
while (more_bytes > 0) {
char *p = vstr_add_len(&vstr, more_bytes);
- if (p == NULL) {
- mp_raise_msg(&mp_type_MemoryError, "out of memory");
- }
int error;
mp_uint_t out_sz = mp_stream_read_exactly(args[0], p, more_bytes, &error);
if (error != 0) {
@@ -380,10 +377,6 @@ STATIC mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args)
while (max_size == -1 || max_size-- != 0) {
char *p = vstr_add_len(&vstr, 1);
- if (p == NULL) {
- mp_raise_msg(&mp_type_MemoryError, "out of memory");
- }
-
int error;
mp_uint_t out_sz = stream_p->read(args[0], p, 1, &error);
if (out_sz == MP_STREAM_ERROR) {