[HB] Add get_reference_count()

This commit is contained in:
Behdad Esfahbod 2009-08-01 21:36:15 -04:00
parent baec684fde
commit a12dd324a3
5 changed files with 52 additions and 0 deletions

View File

@ -95,6 +95,12 @@ hb_blob_reference (hb_blob_t *blob)
HB_OBJECT_DO_REFERENCE (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 void
hb_blob_destroy (hb_blob_t *blob) hb_blob_destroy (hb_blob_t *blob)
{ {

View File

@ -49,6 +49,9 @@ hb_blob_create (const char *data,
hb_blob_t * hb_blob_t *
hb_blob_reference (hb_blob_t *blob); hb_blob_reference (hb_blob_t *blob);
unsigned int
hb_blob_get_reference_count (hb_blob_t *blob);
void void
hb_blob_destroy (hb_blob_t *blob); hb_blob_destroy (hb_blob_t *blob);

View File

@ -62,6 +62,12 @@ hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks)
HB_OBJECT_DO_REFERENCE (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 void
hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks) 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); 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 void
hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks) 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); HB_OBJECT_DO_REFERENCE (face);
} }
unsigned int
hb_face_get_reference_count (hb_face_t *face)
{
HB_OBJECT_DO_GET_REFERENCE_COUNT (face);
}
void void
hb_face_destroy (hb_face_t *face) hb_face_destroy (hb_face_t *face)
{ {
@ -280,6 +298,12 @@ hb_font_reference (hb_font_t *font)
HB_OBJECT_DO_REFERENCE (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 void
hb_font_destroy (hb_font_t *font) hb_font_destroy (hb_font_t *font)
{ {

View File

@ -41,6 +41,9 @@ hb_font_callbacks_create (void);
hb_font_callbacks_t * hb_font_callbacks_t *
hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks); hb_font_callbacks_reference (hb_font_callbacks_t *fcallbacks);
unsigned int
hb_font_callbacks_get_reference_count (hb_font_callbacks_t *fcallbacks);
void void
hb_font_callbacks_destroy (hb_font_callbacks_t *fcallbacks); 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_t *
hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks); hb_unicode_callbacks_reference (hb_unicode_callbacks_t *ucallbacks);
unsigned int
hb_unicode_callbacks_get_reference_count (hb_unicode_callbacks_t *ucallbacks);
void void
hb_unicode_callbacks_destroy (hb_unicode_callbacks_t *ucallbacks); 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_t *
hb_face_reference (hb_face_t *face); hb_face_reference (hb_face_t *face);
unsigned int
hb_face_get_reference_count (hb_face_t *face);
void void
hb_face_destroy (hb_face_t *face); hb_face_destroy (hb_face_t *face);
@ -151,6 +160,9 @@ hb_font_create (hb_face_t *face);
hb_font_t * hb_font_t *
hb_font_reference (hb_font_t *font); hb_font_reference (hb_font_t *font);
unsigned int
hb_font_get_reference_count (hb_font_t *font);
void void
hb_font_destroy (hb_font_t *font); hb_font_destroy (hb_font_t *font);

View File

@ -84,6 +84,13 @@ typedef struct {
return obj; \ return obj; \
} HB_STMT_END } 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) \ #define HB_OBJECT_DO_DESTROY(obj) \
HB_STMT_START { \ HB_STMT_START { \
if (HB_OBJECT_IS_INERT (obj)) \ if (HB_OBJECT_IS_INERT (obj)) \