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