On Fri, Oct 09, 2020 at 12:24:19PM -0500, Eric Blake wrote: > On 10/9/20 11:01 AM, Eduardo Habkost wrote: > > The existing object_class_property_add_uint*_ptr() functions are > > not very useful, because they need a pointer to the property > > value, which can't really be provided before the object is > > created. > > > > Replace the pointer parameter in those functions with a > > `ptrdiff_t offset` parameter. > > > > Include a uint8 class property in check-qom-proplist unit tests, > > to ensure the feature is working. > > > > Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> > > --- > > > static void *pointer_property_get_ptr(Object *obj, PointerProperty *prop) > > { > > - return prop->ptr; > > + if (prop->is_offset) { > > + return (void *)obj + prop->offset; > > Addition on void* is a gcc extension. Does clang support it as well, or > should you be casting to char* instead?
Both object_link_get_targetp() and object_link_get_targetp() already use it, so it should be OK. -- Eduardo