summaryrefslogtreecommitdiff
path: root/src/upb.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-11-14 21:59:31 -0800
committerJoshua Haberman <joshua@reverberate.org>2009-11-14 21:59:31 -0800
commit868f118797969cd0178d38207330e410267e6c46 (patch)
tree650c891eae81fc946e24e3a1cf0e9ee3e3c09c55 /src/upb.h
parent7cde43ea0abf2022a0c800c7af1d5f1ec2033bea (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.h11
1 files changed, 4 insertions, 7 deletions
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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback