cogl: Don't define the deprecated ref/unref accessors for new types

Previously COGL_OBJECT_DEFINE would always define deprecated
cogl_$type_{ref,unref} functions even if the type is new or if the
type is entirely internal. An application would still find it
difficult to use these because they wouldn't be in the headers, but it
still looks bad that they are exported from the shared library. This
patch changes it so that the deprecated ref counting functions are
defined using a separate macro and only the types that have these
functions in the headers call this macro.
This commit is contained in:
Neil Roberts 2010-07-09 17:59:16 +01:00
parent 903560c6c8
commit 89cb325fd4
6 changed files with 8 additions and 1 deletions

View File

@ -115,6 +115,7 @@ static void _cogl_offscreen_free (CoglOffscreen *offscreen);
COGL_OBJECT_DEFINE (Onscreen, onscreen); COGL_OBJECT_DEFINE (Onscreen, onscreen);
COGL_OBJECT_DEFINE (Offscreen, offscreen); COGL_OBJECT_DEFINE (Offscreen, offscreen);
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen);
/* XXX: /* XXX:
* The CoglObject macros don't support any form of inheritance, so for * The CoglObject macros don't support any form of inheritance, so for

View File

@ -112,6 +112,7 @@ static const CoglMaterialBackend *backends[COGL_MATERIAL_N_BACKENDS];
#endif #endif
COGL_OBJECT_DEFINE (Material, material); COGL_OBJECT_DEFINE (Material, material);
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (material);
COGL_OBJECT_DEFINE (MaterialLayer, material_layer); COGL_OBJECT_DEFINE (MaterialLayer, material_layer);
static void static void

View File

@ -166,7 +166,9 @@ cogl_is_##type_name (void *object) \
\ \
return (obj->klass->type == \ return (obj->klass->type == \
_cogl_object_##type_name##_get_type ()); \ _cogl_object_##type_name##_get_type ()); \
} \ }
#define COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING(type_name) \
\ \
void * G_GNUC_DEPRECATED \ void * G_GNUC_DEPRECATED \
cogl_##type_name##_ref (void *object) \ cogl_##type_name##_ref (void *object) \

View File

@ -212,6 +212,7 @@ static void _cogl_vertex_buffer_free (CoglVertexBuffer *buffer);
static void _cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *buffer_indices); static void _cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *buffer_indices);
COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer); COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer);
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (vertex_buffer);
COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices); COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices);
CoglHandle CoglHandle

View File

@ -43,6 +43,7 @@
static void _cogl_shader_free (CoglShader *shader); static void _cogl_shader_free (CoglShader *shader);
COGL_HANDLE_DEFINE (Shader, shader); COGL_HANDLE_DEFINE (Shader, shader);
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (shader);
static void static void
_cogl_shader_free (CoglShader *shader) _cogl_shader_free (CoglShader *shader)

View File

@ -37,6 +37,7 @@
static void _cogl_shader_free (CoglShader *shader); static void _cogl_shader_free (CoglShader *shader);
COGL_HANDLE_DEFINE (Shader, shader); COGL_HANDLE_DEFINE (Shader, shader);
COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (shader);
static void static void
_cogl_shader_free (CoglShader *shader) _cogl_shader_free (CoglShader *shader)