diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-11-14 21:59:31 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-11-14 21:59:31 -0800 |
commit | 868f118797969cd0178d38207330e410267e6c46 (patch) | |
tree | 650c891eae81fc946e24e3a1cf0e9ee3e3c09c55 /src/upb.h | |
parent | 7cde43ea0abf2022a0c800c7af1d5f1ec2033bea (diff) |
Changed parse API to know about msgdefs.
This should make it both easier to use and easier to
optimize, in exchange for a small amount of generality.
In practice, any remotely normal case is still very
natural.
Diffstat (limited to 'src/upb.h')
-rw-r--r-- | src/upb.h | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -140,13 +140,10 @@ union upb_value_ptr { void *_void; }; -// Unfortunately there is no way to define this so that it can be used as a -// generic expression, a la: -// foo(UPB_VALUE_ADDROF(bar)); -// ...you have to use it as the initializer of a upb_value_ptr: -// union upb_value_ptr p = UPB_VALUE_ADDROF(bar); -// foo(p); -#define UPB_VALUE_ADDROF(val) {(void*)&val._double} +INLINE union upb_value_ptr upb_value_addrof(union upb_value *val) { + union upb_value_ptr ptr = {&val->_double}; + return ptr; +} /** * Converts upb_value_ptr -> upb_value by reading from the pointer. We need to |