Re: avoiding relocations in type registration



On 4/21/06, Tim Janik <timj imendio com> wrote:
> >
> > GType
> > g_type_register_static_simple (GType             parent_type,
> >                              const gchar      *type_name,
> >                               guint16           class_size,
>
> can you make this a guint instead?
>
> >                               GClassInitFunc    class_init,
> >                               guint16           instance_size,
>
> and this? i don't think restricting to guint16 here really buys us anything.

sure, I'll change it. I was just copying the types from GTypeInfo.

> >
> > The current trivial implementation fills a GTypeInfo struct on the
> > stack, but it should be possible to avoid the use of a struct
> > altogether.
>
> you mean inside g_type_register_static_simple? i don't see what's
> wrong with the way you did it, i'd leave it as that.

What I meant is that check_type_info_I and type_data_make_W poke all
the fields out of the info struct again; it is not kept around after the node
is constructed. Thus one could avoid setting up the struct in the first place
and pass the fields directly to that check_type_info_I and type_data_make_W.
But 'm fine with keeping the current approach.

Matthias



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