From d619852e06983dc30d2070f6c4af32d563b101f2 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 19 May 2011 10:56:34 -0700 Subject: Change dispatcher error handling model. Now the dispatcher will call error handlers instaed of returning statuses that the caller has to constantly check. --- src/upb_textprinter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/upb_textprinter.c') diff --git a/src/upb_textprinter.c b/src/upb_textprinter.c index 7d0a9dd..bbf7919 100644 --- a/src/upb_textprinter.c +++ b/src/upb_textprinter.c @@ -151,12 +151,13 @@ static upb_sflow_t upb_textprinter_startsubmsg(void *_p, upb_value fval) { upb_textprinter *p = _p; upb_fielddef *f = upb_value_getfielddef(fval); upb_textprinter_indent(p); - CHECK(upb_bytesink_printf(p->bytesink, &p->status, UPB_STRFMT " {", UPB_STRARG(f->name))); - if(!p->single_line) upb_bytesink_putstr(p->bytesink, UPB_STRLIT("\n"), &p->status); + bool ret = upb_bytesink_printf(p->bytesink, &p->status, + UPB_STRFMT " {", UPB_STRARG(f->name)); + if (!ret) return UPB_SBREAK; + if (!p->single_line) + upb_bytesink_putstr(p->bytesink, UPB_STRLIT("\n"), &p->status); p->indent_depth++; return UPB_CONTINUE_WITH(_p); -err: - return UPB_S_BREAK; } static upb_flow_t upb_textprinter_endsubmsg(void *_p, upb_value fval) { -- cgit v1.2.3