From 89cb325fd4e921149fc9ad861d66ef1ed9acd3df Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 9 Jul 2010 17:59:16 +0100 Subject: [PATCH] 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. --- clutter/cogl/cogl/cogl-framebuffer.c | 1 + clutter/cogl/cogl/cogl-material.c | 1 + clutter/cogl/cogl/cogl-object-private.h | 4 +++- clutter/cogl/cogl/cogl-vertex-buffer.c | 1 + clutter/cogl/cogl/driver/gl/cogl-shader.c | 1 + clutter/cogl/cogl/driver/gles/cogl-shader.c | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clutter/cogl/cogl/cogl-framebuffer.c b/clutter/cogl/cogl/cogl-framebuffer.c index 517156ab9..3d8b837e9 100644 --- a/clutter/cogl/cogl/cogl-framebuffer.c +++ b/clutter/cogl/cogl/cogl-framebuffer.c @@ -115,6 +115,7 @@ static void _cogl_offscreen_free (CoglOffscreen *offscreen); COGL_OBJECT_DEFINE (Onscreen, onscreen); COGL_OBJECT_DEFINE (Offscreen, offscreen); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (offscreen); /* XXX: * The CoglObject macros don't support any form of inheritance, so for diff --git a/clutter/cogl/cogl/cogl-material.c b/clutter/cogl/cogl/cogl-material.c index d9020fce2..3b2edc49d 100644 --- a/clutter/cogl/cogl/cogl-material.c +++ b/clutter/cogl/cogl/cogl-material.c @@ -112,6 +112,7 @@ static const CoglMaterialBackend *backends[COGL_MATERIAL_N_BACKENDS]; #endif COGL_OBJECT_DEFINE (Material, material); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (material); COGL_OBJECT_DEFINE (MaterialLayer, material_layer); static void diff --git a/clutter/cogl/cogl/cogl-object-private.h b/clutter/cogl/cogl/cogl-object-private.h index acf98c0fa..8f56c4a40 100644 --- a/clutter/cogl/cogl/cogl-object-private.h +++ b/clutter/cogl/cogl/cogl-object-private.h @@ -166,7 +166,9 @@ cogl_is_##type_name (void *object) \ \ return (obj->klass->type == \ _cogl_object_##type_name##_get_type ()); \ -} \ +} + +#define COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING(type_name) \ \ void * G_GNUC_DEPRECATED \ cogl_##type_name##_ref (void *object) \ diff --git a/clutter/cogl/cogl/cogl-vertex-buffer.c b/clutter/cogl/cogl/cogl-vertex-buffer.c index 9664adc96..ea7399d3b 100644 --- a/clutter/cogl/cogl/cogl-vertex-buffer.c +++ b/clutter/cogl/cogl/cogl-vertex-buffer.c @@ -212,6 +212,7 @@ static void _cogl_vertex_buffer_free (CoglVertexBuffer *buffer); static void _cogl_vertex_buffer_indices_free (CoglVertexBufferIndices *buffer_indices); COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (vertex_buffer); COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices); CoglHandle diff --git a/clutter/cogl/cogl/driver/gl/cogl-shader.c b/clutter/cogl/cogl/driver/gl/cogl-shader.c index dad2ba77f..50c4f9687 100644 --- a/clutter/cogl/cogl/driver/gl/cogl-shader.c +++ b/clutter/cogl/cogl/driver/gl/cogl-shader.c @@ -43,6 +43,7 @@ static void _cogl_shader_free (CoglShader *shader); COGL_HANDLE_DEFINE (Shader, shader); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (shader); static void _cogl_shader_free (CoglShader *shader) diff --git a/clutter/cogl/cogl/driver/gles/cogl-shader.c b/clutter/cogl/cogl/driver/gles/cogl-shader.c index b3dded175..c2e1114f6 100644 --- a/clutter/cogl/cogl/driver/gles/cogl-shader.c +++ b/clutter/cogl/cogl/driver/gles/cogl-shader.c @@ -37,6 +37,7 @@ static void _cogl_shader_free (CoglShader *shader); COGL_HANDLE_DEFINE (Shader, shader); +COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING (shader); static void _cogl_shader_free (CoglShader *shader)