cogl: Don't define the deprecated ref/unref accessors for new types
authorNeil Roberts <neil@linux.intel.com>
Fri, 9 Jul 2010 16:59:16 +0000 (17:59 +0100)
committerNeil Roberts <neil@linux.intel.com>
Fri, 9 Jul 2010 17:57:54 +0000 (18:57 +0100)
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
clutter/cogl/cogl/cogl-material.c
clutter/cogl/cogl/cogl-object-private.h
clutter/cogl/cogl/cogl-vertex-buffer.c
clutter/cogl/cogl/driver/gl/cogl-shader.c
clutter/cogl/cogl/driver/gles/cogl-shader.c

index 517156a..3d8b837 100644 (file)
@@ -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
index d9020fc..3b2edc4 100644 (file)
@@ -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
index acf98c0..8f56c4a 100644 (file)
@@ -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)                           \
index 9664adc..ea7399d 100644 (file)
@@ -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
index dad2ba7..50c4f96 100644 (file)
@@ -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)
index b3dded1..c2e1114 100644 (file)
@@ -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)