diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-05-20 11:26:27 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-05-20 11:26:27 -0700 |
commit | 0941664215ed7fa4a8d53b6387d50c56df6757d0 (patch) | |
tree | 9125c22f6892015e05fa709426a6cc8b082972ad /src/upb_textprinter.c | |
parent | 74102e836d285bcfcb4c22cbe72a3a36828d30cb (diff) |
Add startseq/endseq handlers.
Startseq/endseq handlers are called at the beginning
and end of a sequence of repeated values. Protobuf
does not really have direct support for this (repeated
primitive fields do not delimit "begin" and "end" of
the sequence) but we can infer them from the bytestream.
The benefit of supporting them explicitly is that they
get their own stack frame and closure, so we can avoid
having to find the array's address over and over and
deciding if we need to initialize it.
This will also pave the way for better support of JSON,
which does have explicit "startseq/endseq" markers: [].
Diffstat (limited to 'src/upb_textprinter.c')
-rw-r--r-- | src/upb_textprinter.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/upb_textprinter.c b/src/upb_textprinter.c index bbf7919..ec76d56 100644 --- a/src/upb_textprinter.c +++ b/src/upb_textprinter.c @@ -192,7 +192,9 @@ upb_mhandlers *upb_textprinter_reghandlers(upb_handlers *h, upb_msgdef *m) { NULL, // endmsg upb_textprinter_value, upb_textprinter_startsubmsg, - upb_textprinter_endsubmsg + upb_textprinter_endsubmsg, + NULL, // startseq + NULL, // endseq }; return upb_handlers_reghandlerset(h, m, &hset); } |