diff options
author | Joshua Haberman <joshua@reverberate.org> | 2010-01-13 19:06:23 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2010-01-13 19:06:23 -0800 |
commit | 50451ea441280fe193c1c344e299977d8fcbdcc7 (patch) | |
tree | b4ed49055b1d9f5ae2029742510a358a9625a29a /src/upb_parse.c | |
parent | d7d1b2a14120e0194aadcfcb327a542f81213058 (diff) |
Make onend upb_sink callback take the field as a parameter.
Diffstat (limited to 'src/upb_parse.c')
-rw-r--r-- | src/upb_parse.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/upb_parse.c b/src/upb_parse.c index 577fa5c..be22203 100644 --- a/src/upb_parse.c +++ b/src/upb_parse.c @@ -37,7 +37,8 @@ INLINE const uint8_t *upb_get_v_uint64_t(const uint8_t *buf, const uint8_t *end, } } -// Gets a varint -- called when we only need 32 bits of it. +// Gets a varint -- called when we only need 32 bits of it. Note that a 32-bit +// varint is not a true wire type. INLINE const uint8_t *upb_get_v_uint32_t(const uint8_t *buf, const uint8_t *end, uint32_t *val, struct upb_status *status) @@ -312,6 +313,7 @@ static const uint8_t *upb_parse_value(const uint8_t *buf, const uint8_t *end, struct upb_parser_frame { struct upb_msgdef *msgdef; + struct upb_fielddef *field; size_t end_offset; // For groups, 0. }; @@ -380,6 +382,7 @@ static const uint8_t *push(upb_parser *p, const uint8_t *start, uint32_t submsg_len, struct upb_fielddef *f, struct upb_status *status) { + p->top->field = f; p->top++; if(p->top >= p->limit) { upb_seterr(status, UPB_STATUS_ERROR, @@ -401,8 +404,8 @@ static const uint8_t *push(upb_parser *p, const uint8_t *start, */ static const void *pop(upb_parser *p, const uint8_t *start) { - upb_sink_onend(p->sink); p->top--; + upb_sink_onend(p->sink, p->top->field); return get_msgend(p, start); } |