From 868f118797969cd0178d38207330e410267e6c46 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 14 Nov 2009 21:59:31 -0800 Subject: 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. --- src/upb.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/upb.h') diff --git a/src/upb.h b/src/upb.h index e8ec001..cc09ab1 100644 --- a/src/upb.h +++ b/src/upb.h @@ -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 -- cgit v1.2.3