[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES()
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES() |
Date: |
Thu, 5 Oct 2017 10:10:41 +0200 |
On Wed, 4 Oct 2017 18:04:59 -0300
Eduardo Habkost <address@hidden> wrote:
> On Wed, Oct 04, 2017 at 12:08:02PM +0200, Igor Mammedov wrote:
> > DEFINE_TYPES() will help to simplify following routine patterns:
> >
> > static void foo_register_types(void)
> > {
> > type_register_static(&foo1_type_info);
> > type_register_static(&foo2_type_info);
> > ...
> > }
> >
> > type_init(foo_register_types)
> >
> > or
> >
> > static void foo_register_types(void)
> > {
> > int i;
> >
> > for (i = 0; i < ARRAY_SIZE(type_infos); i++) {
> > type_register_static(&type_infos[i]);
> > }
> > }
> >
> > type_init(foo_register_types)
> >
> > with a single line
> >
> > DEFINE_TYPES(type_infos)
> >
> > where types have static definition which could be consolidated in
> > a single array of TypeInfo structures.
> > It saves us ~6-10LOC per use case and would help to replace
> > imperative foo_register_types() there with declarative style of
> > type registration.
> >
> > Signed-off-by: Igor Mammedov <address@hidden>
>
> Reviewed-by: Eduardo Habkost <address@hidden>
>
> I will wait for 1 day or 2 before queueing it.
Thanks!
I'll respin whole series with amended "foo: cleanup cpu type name composition"
patches due to s/type_init_from_array/DEFINE_TYPES/ change
- Re: [Qemu-devel] [PATCH] qom: add helpers REGISTER_STATIC_TYPE[S](), (continued)
[Qemu-devel] [PATCH v2 0/3] add DEFINE_TYPES() helper to simplify batch type registration, Igor Mammedov, 2017/10/04
[Qemu-devel] [PATCH v2 1/3] qom: update doc comment for type_register[_static](), Igor Mammedov, 2017/10/04
Re: [Qemu-devel] [PATCH v2 1/3] qom: update doc comment for type_register[_static](), Eduardo Habkost, 2017/10/04
[Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES(), Igor Mammedov, 2017/10/04
Re: [Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES(), Eduardo Habkost, 2017/10/04
Re: [Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES(),
Igor Mammedov <=
Re: [Qemu-devel] [PATCH v2 3/3] qom: add helper macro DEFINE_TYPES(), Philippe Mathieu-Daudé, 2017/10/05
[Qemu-devel] [PATCH 02/38] alpha: cleanup cpu type name composition, Igor Mammedov, 2017/10/02
[Qemu-devel] [PATCH 07/38] lm32: milkymist: use generic cpu_model parsing, Igor Mammedov, 2017/10/02
[Qemu-devel] [PATCH 04/38] cris: cleanup cpu type name composition, Igor Mammedov, 2017/10/02