This macro will be used to generate the boilerplate property_class_set_type_ptr() QOM set function for the specified scalar type.
Signed-off-by: Mark Cave-Ayland <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> --- qom/object.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qom/object.c b/qom/object.c index e32ae30bd5..fe4e552928 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2722,7 +2722,24 @@ static void *object_class_prop_ptr(Object *obj, ptrdiff_t offset) visit_type_##type(v, name, &value, errp); \ } +#define OBJECT_CLASS_PROPERTY_SCALAR_SETTER(type) \ + static void property_class_set_##type##_ptr(Object *obj, Visitor *v, \ + const char *name, \ + void *opaque, Error **errp) \ + { \ + type##_t *field = (type##_t *)object_class_prop_ptr(obj, \ + (ptrdiff_t)opaque); \ + type##_t value; \ + \ + if (!visit_type_##type(v, name, &value, errp)) { \ + return; \ + } \ + \ + *field = value; \ + } + #undef OBJECT_CLASS_PROPERTY_SCALAR_GETTER +#undef OBJECT_CLASS_PROPERTY_SCALAR_SETTER ObjectProperty * -- 2.43.0
