object: Remove the type member of CoglObjectClass

Unlike in GObject the type number for a CoglObject is entirely an
internal implementation detail so there is no need to make a GQuark to
make it safe to export out of the library. Instead we can just
directly use a fixed pointer address as the identifier for the type.
This patch makes it use the address of the class struct of the
identifier. This should make it faster to do type checks because it
does not need to call a function every time it wants to get the type
number.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts
2012-01-24 16:24:26 +00:00
parent c39333a2c6
commit 139421de19
15 changed files with 37 additions and 86 deletions

View File

@ -78,12 +78,11 @@
*/
void
_cogl_buffer_register_buffer_type (GQuark type)
_cogl_buffer_register_buffer_type (const CoglObjectClass *klass)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
ctx->buffer_types = g_slist_prepend (ctx->buffer_types,
GINT_TO_POINTER (type));
ctx->buffer_types = g_slist_prepend (ctx->buffer_types, (void *) klass);
}
gboolean
@ -98,7 +97,7 @@ cogl_is_buffer (const void *object)
return FALSE;
for (l = ctx->buffer_types; l; l = l->next)
if (GPOINTER_TO_INT (l->data) == obj->klass->type)
if (l->data == obj->klass)
return TRUE;
return FALSE;