Intern type names before registering the type to avoid unnecessary copies.

2005-08-31  Matthias Clasen  <mclasen@redhat.com>

	* gvaluetypes.c (g_value_types_init):
	* gtypeplugin.c (g_type_plugin_get_type):
	* gtypemodule.c (g_type_module_get_type):
	* gparam.c (g_param_type_init):
	* gobject.c (g_object_type_init):
	* genums.c (g_enum_types_init):
	* gboxed.c (g_boxed_type_init): Intern type names
	before registering the type to avoid unnecessary
	copies.
This commit is contained in:
Matthias Clasen 2005-08-31 14:38:18 +00:00 committed by Matthias Clasen
parent 70af0de0ef
commit 07c4d80d55
8 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,15 @@
2005-08-31 Matthias Clasen <mclasen@redhat.com>
* gvaluetypes.c (g_value_types_init):
* gtypeplugin.c (g_type_plugin_get_type):
* gtypemodule.c (g_type_module_get_type):
* gparam.c (g_param_type_init):
* gobject.c (g_object_type_init):
* genums.c (g_enum_types_init):
* gboxed.c (g_boxed_type_init): Intern type names
before registering the type to avoid unnecessary
copies.
2005-08-23 Matthias Clasen <mclasen@redhat.com>
* === Released 2.8.1 ===

View File

@ -139,7 +139,7 @@ g_boxed_type_init (void)
/* G_TYPE_BOXED
*/
type = g_type_register_fundamental (G_TYPE_BOXED, "GBoxed", &info, &finfo,
type = g_type_register_fundamental (G_TYPE_BOXED, g_intern_static_string ("GBoxed"), &info, &finfo,
G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
g_assert (type == G_TYPE_BOXED);
}

View File

@ -86,14 +86,14 @@ g_enum_types_init (void)
/* G_TYPE_ENUM
*/
info.class_size = sizeof (GEnumClass);
type = g_type_register_fundamental (G_TYPE_ENUM, "GEnum", &info, &finfo,
type = g_type_register_fundamental (G_TYPE_ENUM, g_intern_static_string ("GEnum"), &info, &finfo,
G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
g_assert (type == G_TYPE_ENUM);
/* G_TYPE_FLAGS
*/
info.class_size = sizeof (GFlagsClass);
type = g_type_register_fundamental (G_TYPE_FLAGS, "GFlags", &info, &finfo,
type = g_type_register_fundamental (G_TYPE_FLAGS, g_intern_static_string ("GFlags"), &info, &finfo,
G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
g_assert (type == G_TYPE_FLAGS);
}

View File

@ -185,7 +185,7 @@ g_object_type_init (void)
/* G_TYPE_OBJECT
*/
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_OBJECT, "GObject", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_OBJECT, g_intern_static_string ("GObject"), &info, &finfo, 0);
g_assert (type == G_TYPE_OBJECT);
g_value_register_transform_func (G_TYPE_OBJECT, G_TYPE_OBJECT, g_value_object_transform_value);

View File

@ -103,7 +103,7 @@ g_param_type_init (void)
};
GType type;
type = g_type_register_fundamental (G_TYPE_PARAM, "GParam", &param_spec_info, &finfo, G_TYPE_FLAG_ABSTRACT);
type = g_type_register_fundamental (G_TYPE_PARAM, g_intern_static_string ("GParam"), &param_spec_info, &finfo, G_TYPE_FLAG_ABSTRACT);
g_assert (type == G_TYPE_PARAM);
g_value_register_transform_func (G_TYPE_PARAM, G_TYPE_PARAM, value_param_transform_value);
}

View File

@ -123,7 +123,7 @@ g_type_module_get_type (void)
NULL, /* interface_data */
};
type_module_type = g_type_register_static (G_TYPE_OBJECT, "GTypeModule", &type_module_info, G_TYPE_FLAG_ABSTRACT);
type_module_type = g_type_register_static (G_TYPE_OBJECT, g_intern_static_string ("GTypeModule"), &type_module_info, G_TYPE_FLAG_ABSTRACT);
g_type_add_interface_static (type_module_type, G_TYPE_TYPE_PLUGIN, &iface_info);
}

View File

@ -35,7 +35,7 @@ g_type_plugin_get_type (void)
NULL, /* base_finalize */
};
type_plugin_type = g_type_register_static (G_TYPE_INTERFACE, "GTypePlugin", &type_plugin_info, 0);
type_plugin_type = g_type_register_static (G_TYPE_INTERFACE, g_intern_static_string ("GTypePlugin"), &type_plugin_info, 0);
}
return type_plugin_type;

View File

@ -389,9 +389,9 @@ g_value_types_init (void)
value_lcopy_char, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_CHAR, "gchar", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_CHAR, g_intern_static_string ("gchar"), &info, &finfo, 0);
g_assert (type == G_TYPE_CHAR);
type = g_type_register_fundamental (G_TYPE_UCHAR, "guchar", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_UCHAR, g_intern_static_string ("guchar"), &info, &finfo, 0);
g_assert (type == G_TYPE_UCHAR);
}
@ -409,7 +409,7 @@ g_value_types_init (void)
value_lcopy_boolean, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_BOOLEAN, "gboolean", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_BOOLEAN, g_intern_static_string ("gboolean"), &info, &finfo, 0);
g_assert (type == G_TYPE_BOOLEAN);
}
@ -427,9 +427,9 @@ g_value_types_init (void)
value_lcopy_int, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_INT, "gint", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_INT, g_intern_static_string ("gint"), &info, &finfo, 0);
g_assert (type == G_TYPE_INT);
type = g_type_register_fundamental (G_TYPE_UINT, "guint", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_UINT, g_intern_static_string ("guint"), &info, &finfo, 0);
g_assert (type == G_TYPE_UINT);
}
@ -447,9 +447,9 @@ g_value_types_init (void)
value_lcopy_long, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_LONG, "glong", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_LONG, g_intern_static_string ("glong"), &info, &finfo, 0);
g_assert (type == G_TYPE_LONG);
type = g_type_register_fundamental (G_TYPE_ULONG, "gulong", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_ULONG, g_intern_static_string ("gulong"), &info, &finfo, 0);
g_assert (type == G_TYPE_ULONG);
}
@ -467,9 +467,9 @@ g_value_types_init (void)
value_lcopy_int64, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_INT64, "gint64", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_INT64, g_intern_static_string ("gint64"), &info, &finfo, 0);
g_assert (type == G_TYPE_INT64);
type = g_type_register_fundamental (G_TYPE_UINT64, "guint64", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_UINT64, g_intern_static_string ("guint64"), &info, &finfo, 0);
g_assert (type == G_TYPE_UINT64);
}
@ -487,7 +487,7 @@ g_value_types_init (void)
value_lcopy_float, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_FLOAT, "gfloat", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_FLOAT, g_intern_static_string ("gfloat"), &info, &finfo, 0);
g_assert (type == G_TYPE_FLOAT);
}
@ -505,7 +505,7 @@ g_value_types_init (void)
value_lcopy_double, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_DOUBLE, "gdouble", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_DOUBLE, g_intern_static_string ("gdouble"), &info, &finfo, 0);
g_assert (type == G_TYPE_DOUBLE);
}
@ -523,7 +523,7 @@ g_value_types_init (void)
value_lcopy_string, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_STRING, "gchararray", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_STRING, g_intern_static_string ("gchararray"), &info, &finfo, 0);
g_assert (type == G_TYPE_STRING);
}
@ -541,7 +541,7 @@ g_value_types_init (void)
value_lcopy_pointer, /* lcopy_value */
};
info.value_table = &value_table;
type = g_type_register_fundamental (G_TYPE_POINTER, "gpointer", &info, &finfo, 0);
type = g_type_register_fundamental (G_TYPE_POINTER, g_intern_static_string ("gpointer"), &info, &finfo, 0);
g_assert (type == G_TYPE_POINTER);
}
}