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