Remove n_preallocs field from InstanceData

The GTypeInfo.n_preallocs field has been ignored since GLib 2.10, but it
hasn't been removed from the internal instance data representation.
This commit is contained in:
Emmanuele Bassi 2023-02-04 16:55:30 +01:00
parent 35170735de
commit 8f92f742b9
2 changed files with 2 additions and 4 deletions

View File

@ -356,7 +356,6 @@ struct _InstanceData
gpointer class; gpointer class;
guint16 instance_size; guint16 instance_size;
guint16 private_size; guint16 private_size;
guint16 n_preallocs;
GInstanceInitFunc instance_init; GInstanceInitFunc instance_init;
}; };
@ -915,7 +914,7 @@ check_type_info_I (TypeNode *pnode,
/* check instance members */ /* check instance members */
if (!(finfo->type_flags & G_TYPE_FLAG_INSTANTIATABLE) && if (!(finfo->type_flags & G_TYPE_FLAG_INSTANTIATABLE) &&
(info->instance_size || info->n_preallocs || info->instance_init)) (info->instance_size || info->instance_init))
{ {
if (pnode) if (pnode)
g_critical ("cannot instantiate '%s', derived from non-instantiatable parent type '%s'", g_critical ("cannot instantiate '%s', derived from non-instantiatable parent type '%s'",
@ -1158,7 +1157,6 @@ type_data_make_W (TypeNode *node,
data->instance.class_private_size = 0; data->instance.class_private_size = 0;
if (pnode) if (pnode)
data->instance.class_private_size = pnode->data->instance.class_private_size; data->instance.class_private_size = pnode->data->instance.class_private_size;
data->instance.n_preallocs = MIN (info->n_preallocs, 1024);
data->instance.instance_init = info->instance_init; data->instance.instance_init = info->instance_init;
} }
else if (node->is_classed) /* only classed */ else if (node->is_classed) /* only classed */

View File

@ -1093,7 +1093,7 @@ typedef enum /*< skip >*/
* finalization function for interface types. (optional) * finalization function for interface types. (optional)
* @class_data: User-supplied data passed to the class init/finalize functions * @class_data: User-supplied data passed to the class init/finalize functions
* @instance_size: Size of the instance (object) structure (required for instantiatable types only) * @instance_size: Size of the instance (object) structure (required for instantiatable types only)
* @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the [slice allocator][glib-Memory-Slices] now. * @n_preallocs: Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10 this field is ignored.
* @instance_init: Location of the instance initialization function (optional, for instantiatable types only) * @instance_init: Location of the instance initialization function (optional, for instantiatable types only)
* @value_table: A #GTypeValueTable function table for generic handling of GValues * @value_table: A #GTypeValueTable function table for generic handling of GValues
* of this type (usually only useful for fundamental types) * of this type (usually only useful for fundamental types)