[HB] Add get_reference_count()
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 2 Aug 2009 01:36:15 +0000 (21:36 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 2 Nov 2009 19:40:25 +0000 (14:40 -0500)
src/hb-blob.c
src/hb-blob.h
src/hb-font.c
src/hb-font.h
src/hb-object-private.h

index 512bec9..cf9dd53 100644 (file)
@@ -95,6 +95,12 @@ hb_blob_reference (hb_blob_t *blob)
   HB_OBJECT_DO_REFERENCE (blob);
 }
 
+unsigned int
+hb_blob_get_reference_count (hb_blob_t *blob)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (blob);
+}
+
 void
 hb_blob_destroy (hb_blob_t *blob)
 {
index 1066821..21aa365 100644 (file)
@@ -49,6 +49,9 @@ hb_blob_create (const char        *data,
 hb_blob_t *
 hb_blob_reference (hb_blob_t *blob);
 
+unsigned int
+hb_blob_get_reference_count (hb_blob_t *blob);
+
 void
 hb_blob_destroy (hb_blob_t *blob);
 
index b2cf440..078a3bc 100644 (file)
@@ -62,6 +62,12 @@ hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks)
   HB_OBJECT_DO_REFERENCE (fcallbacks);
 }
 
+unsigned int
+hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (fcallbacks);
+}
+
 void
 hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks)
 {
@@ -120,6 +126,12 @@ hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks)
   HB_OBJECT_DO_REFERENCE (ucallbacks);
 }
 
+unsigned int
+hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (ucallbacks);
+}
+
 void
 hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks)
 {
@@ -203,6 +215,12 @@ hb_face_reference (hb_face_t *face)
   HB_OBJECT_DO_REFERENCE (face);
 }
 
+unsigned int
+hb_face_get_reference_count (hb_face_t *face)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (face);
+}
+
 void
 hb_face_destroy (hb_face_t *face)
 {
@@ -280,6 +298,12 @@ hb_font_reference (hb_font_t *font)
   HB_OBJECT_DO_REFERENCE (font);
 }
 
+unsigned int
+hb_font_get_reference_count (hb_font_t *font)
+{
+  HB_OBJECT_DO_GET_REFERENCE_COUNT (font);
+}
+
 void
 hb_font_destroy (hb_font_t *font)
 {
index d287145..2c85339 100644 (file)
@@ -41,6 +41,9 @@ hb_font_callbacks_create (void);
 hb_font_callbacks_t *
 hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks);
 
+unsigned int
+hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks);
+
 void
 hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks);
 
@@ -78,6 +81,9 @@ hb_unicode_callbacks_create (void);
 hb_unicode_callbacks_t *
 hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks);
 
+unsigned int
+hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks);
+
 void
 hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks);
 
@@ -126,6 +132,9 @@ hb_face_create_for_tables (hb_get_table_func_t  get_table,
 hb_face_t *
 hb_face_reference (hb_face_t *face);
 
+unsigned int
+hb_face_get_reference_count (hb_face_t *face);
+
 void
 hb_face_destroy (hb_face_t *face);
 
@@ -151,6 +160,9 @@ hb_font_create (hb_face_t *face);
 hb_font_t *
 hb_font_reference (hb_font_t *font);
 
+unsigned int
+hb_font_get_reference_count (hb_font_t *font);
+
 void
 hb_font_destroy (hb_font_t *font);
 
index 541bad9..4ef2823 100644 (file)
@@ -84,6 +84,13 @@ typedef struct {
     return obj; \
   } HB_STMT_END
 
+#define HB_OBJECT_DO_GET_REFERENCE_COUNT(obj) \
+  HB_STMT_START { \
+    if (HB_OBJECT_IS_INERT (obj)) \
+      return 0; \
+    return HB_REFERENCE_COUNT_GET_VALUE (obj->ref_count); \
+  } HB_STMT_END
+
 #define HB_OBJECT_DO_DESTROY(obj) \
   HB_STMT_START { \
     if (HB_OBJECT_IS_INERT (obj)) \