On 01/25/2012 09:37 AM, Jan Kiszka wrote:
> They're exactly the same size (16 lines). If you embed TypeInfo into
> DeviceTypeInfo, and introduce a Device specific type registration
> function, then you could do:
>
> static DeviceTypeInfo my_device_type_info = {
> .type.name = TYPE_MY_DEVICE,
> .type.parent = TYPE_PARENT_DEVICE,
> .reset = my_device_reset,
And if you introduce some
#define TYPE_UNIMPLEMENTED (void *)&dummy_variable
you can easily express
[.field = NULL] => use parent
.field = UNIMPLEMENTED => don't run any handler
I agree with Anthony, this would get really ugly where you are calling
the functions and doing the class initialization. It's a different
style from what we're used to, granted, but the difference in code size
is not relevant (not enough to introduce a level of macro magic, at
least) and the diffstat in this series is misleading because qdev is
left with temporary duplication for now.
(I also complained with him about this a month ago or so).
Paolo