summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstringio.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-13 11:43:28 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-13 11:46:14 +1100
commite93c1ca5da58df336305c9a5e50214849342f298 (patch)
treece92a2be2e71a207103d5056e3caeff742457d01 /py/objstringio.c
parentf17f3314d0a857fdf06132f3e8ef84a56345622b (diff)
downloadmicropython-e93c1ca5da58df336305c9a5e50214849342f298.tar.gz
micropython-e93c1ca5da58df336305c9a5e50214849342f298.zip
extmod/modujson: Implement ujson.load() to load JSON from a stream.
This refactors ujson.loads(s) to behave as ujson.load(StringIO(s)). Increase in code size is: 366 bytes for unix x86-64, 180 bytes for stmhal, 84 bytes for esp8266.
Diffstat (limited to 'py/objstringio.c')
-rw-r--r--py/objstringio.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/py/objstringio.c b/py/objstringio.c
index eb0cc4eb36..be1a7d89cb 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -30,18 +30,12 @@
#include "py/nlr.h"
#include "py/objstr.h"
+#include "py/objstringio.h"
#include "py/runtime.h"
#include "py/stream.h"
#if MICROPY_PY_IO
-typedef struct _mp_obj_stringio_t {
- mp_obj_base_t base;
- vstr_t *vstr;
- // StringIO has single pointer used for both reading and writing
- mp_uint_t pos;
-} mp_obj_stringio_t;
-
#if MICROPY_CPYTHON_COMPAT
STATIC void check_stringio_is_open(const mp_obj_stringio_t *o) {
if (o->vstr == NULL) {