On Fri, Apr 17, 2015 at 04:55:26PM +0200, Paolo Bonzini wrote: > > > On 17/04/2015 16:22, Daniel P. Berrange wrote: > > + > > +Object *object_new_proplist(const char *typename, > > + const char *id, > > + Error **errp, > > + va_list vargs) > > +{ > > + Object *obj; > > + const char *propname; > > + > > + obj = object_new(typename); > > + > > + if (object_class_is_abstract(object_get_class(obj))) { > > + error_setg(errp, "object type '%s' is abstract", typename); > > + goto error; > > + } > > + > > + propname = va_arg(vargs, char *); > > + while (propname != NULL) { > > + const char *value = va_arg(vargs, char *); > > + > > + object_property_parse(obj, value, propname, errp); > > + if (*errp) { > > + goto error; > > + } > > + propname = va_arg(vargs, char *); > > + } > > + > > + object_property_add_child(container_get(object_get_root(), "/objects"), > > + id, obj, errp); > > I would pass the parent as an additional argument to > object_new_proplist(). Otherwise looks good.
Yep, that does rather make sense for flexibility. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|