From 2c86e7eddb23c92cc83391c3f751c72237ec3759 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Sat, 26 Mar 2011 18:14:01 -0700 Subject: Small semantics changes in the decoder. Simplified some of the semantics around the decoder's data structures, in anticipation of sharing them between the regular C decoder and a JIT-ted decoder. --- src/upb_decoder.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/upb_decoder.h') diff --git a/src/upb_decoder.h b/src/upb_decoder.h index 32a989a..bb54930 100644 --- a/src/upb_decoder.h +++ b/src/upb_decoder.h @@ -34,8 +34,8 @@ struct _upb_decoder { // Dispatcher to which we push parsed data. upb_dispatcher dispatcher; - // Current input buffer. - upb_string *buf; + // String to hold our input buffer; is only active if d->buf != NULL. + upb_string *bufstr; // Temporary string for passing string data to callbacks. upb_string *tmp; @@ -43,18 +43,20 @@ struct _upb_decoder { // The offset within the overall stream represented by the *beginning* of buf. size_t buf_stream_offset; - // Our current position in the data buffer. - const char *ptr; + // Pointer to the beginning of our current data buffer, or NULL if none. + const char *buf; // End of this buffer, relative to *ptr. const char *end; + // Members which may also be written by the JIT: + + // Our current position in the data buffer. + const char *ptr; + // End of this submessage, relative to *ptr. const char *submsg_end; - // The closure that was passed by the caller for the top-level message. - void *closure; - // Where we will store any errors that occur. upb_status *status; }; -- cgit v1.2.3