[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

On 01/11/2013 05:13 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange 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


> 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.


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

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]