[libvirt] [PATCH 1/7] Allow for multi-level inheritance of virObject classes

Eric Blake eblake at redhat.com
Fri Jan 11 23:17:20 UTC 2013


On 01/11/2013 05:13 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Currently all classes must directly inherit from virObject.
> This allows for arbitrarily deep hierarchy. There's not much
> too this aside from chaining up the 'dispose' handlers from

s/too/to/

> each class & providing APIs to check types.
> ---

> -virClassPtr virClassNew(const char *name,
> +virClassPtr virClassNew(virClassPtr parent,
> +                        const char *name,
>                          size_t objectSize,
>                          virObjectDisposeCallback dispose)
>  {
>      virClassPtr klass;
>  
> +    if (parent == NULL &&
> +        STRNEQ(name, "virObject")) {
> +        virReportInvalidNonNullArg(parent);
> +        return NULL;

Would it have been any easier to let callers pass NULL when they want to
have virObject as the default parent, instead of making all callers have
to use virClassForObject()?  Then again, you've already touched
everyone, so don't change the bikeshed color again.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130111/c001bff7/attachment-0001.sig>


More information about the libvir-list mailing list