From ee1ed1ccb87effa403dc91603d452d4c98ed716f Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 22 Jul 2009 19:49:53 -0700 Subject: Compiler finally works (except string arrays). Untested. Holy crap that was a lot of work. --- src/upb_msg.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/upb_msg.h') diff --git a/src/upb_msg.h b/src/upb_msg.h index 6be9405..233e604 100644 --- a/src/upb_msg.h +++ b/src/upb_msg.h @@ -231,7 +231,7 @@ INLINE void upb_msg_unset(void *s, struct upb_msg_field *f) ((char*)s)[upb_isset_offset(f->field_index)] &= ~upb_isset_mask(f->field_index); } -INLINE bool upb_msg_is_set(void *s, struct upb_msg_field *f) +INLINE bool upb_msg_isset(void *s, struct upb_msg_field *f) { return ((char*)s)[upb_isset_offset(f->field_index)] & upb_isset_mask(f->field_index); } @@ -262,6 +262,11 @@ INLINE union upb_value_ptr upb_msg_getptr(void *data, struct upb_msg_field *f) { return p; } +/* Returns a a specific field in a message. */ +INLINE union upb_value upb_msg_get(void *data, struct upb_msg_field *f) { + return upb_deref(upb_msg_getptr(data, f), f->type); +} + /* Memory management *********************************************************/ /* One important note about these memory management routines: they must be used -- cgit v1.2.3