diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/upb_decoder.c | 3 | ||||
-rw-r--r-- | stream/upb_strstream.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/stream/upb_decoder.c b/stream/upb_decoder.c index 588d553..2fadf51 100644 --- a/stream/upb_decoder.c +++ b/stream/upb_decoder.c @@ -389,8 +389,7 @@ void upb_decoder_reset(upb_decoder *d, upb_bytesrc *bytesrc) { d->top->msgdef = d->toplevel_msgdef; // Never want to end top-level message, so treat it like a group. d->top->end_offset = UPB_GROUP_END_OFFSET; - upb_string_unref(d->buf); - d->buf = NULL; + upb_string_recycle(&d->buf); } void upb_decoder_uninit(upb_decoder *d) { diff --git a/stream/upb_strstream.c b/stream/upb_strstream.c index 8a230ae..a7967d4 100644 --- a/stream/upb_strstream.c +++ b/stream/upb_strstream.c @@ -13,7 +13,7 @@ static upb_strlen_t upb_stringsrc_read(upb_bytesrc *_src, void *buf, upb_strlen_t count, upb_status *status) { upb_stringsrc *src = (upb_stringsrc*)_src; if (src->offset == upb_string_len(src->str)) { - upb_seterr(status, UPB_EOF, ""); + status->code = UPB_EOF; return -1; } else { upb_strlen_t to_read = UPB_MIN(count, upb_string_len(src->str) - src->offset); @@ -27,7 +27,7 @@ static bool upb_stringsrc_getstr(upb_bytesrc *_src, upb_string *str, upb_status *status) { upb_stringsrc *src = (upb_stringsrc*)_src; if (src->offset == upb_string_len(src->str)) { - upb_seterr(status, UPB_EOF, ""); + status->code = UPB_EOF; return false; } else { upb_strlen_t len = upb_string_len(src->str) - src->offset; |