[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 01/18] qom: add new dynamic property infrastruct

From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 01/18] qom: add new dynamic property infrastructure based on Visitors
Date: Mon, 05 Dec 2011 10:16:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0

Am 02.12.2011 19:47, schrieb Anthony Liguori:
> On 12/01/2011 09:52 AM, Kevin Wolf wrote:
>> Am 30.11.2011 22:03, schrieb Anthony Liguori:
>>> +
>>> +void qdev_property_add(DeviceState *dev, const char *name, const char 
>>> *type,
>>> +                       DevicePropertyEtter *get, DevicePropertyEtter *set,
>>> +                       DevicePropertyRelease *release, void *opaque,
>>> +                       Error **errp)
>> How about letting the caller pass in a DeviceProperty for improved
>> readability and usability? Instead of memorizing the order of currently
>> eight parameters (could probably become more in the future) you can use
>> proper C99 initializers then.
> This ends up making the code much more complex for the client if you try to 
> eliminate the opaque and replace it with the structure.  It becomes necessary 
> to 
> do a dynamic allocation of the structure and then you also have to add a 
> release 
> function.

Hm, why doesn't static allocation work with it?

> We could make the structure just contain the function pointers and not the 
> opaque but that doesn't seem very helpful to me.  It just adds a few extra 
> lines 
> to the client code without a lot of gain.

I keep switching back and forth between mails to find out what these
parameters are supposed to mean (especially the NULL ones), so yes, I
think even passing just the name and function pointers this way would
improve readability.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]