From af02933739e03a156b9f7761fd7a63e2a02d0df1 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 20 Apr 2011 15:49:31 -0400 Subject: [PATCH] [API] Remove hb_*_get_reference_count() This was a bizzare piece of API that I inherited from cairo. It has been wrong adding them to cairo in the first place. Remove them before someone uses them! --- src/hb-blob.c | 6 ------ src/hb-blob.h | 3 --- src/hb-buffer.cc | 6 ------ src/hb-buffer.h | 3 --- src/hb-font.cc | 18 ------------------ src/hb-font.h | 9 --------- src/hb-object-private.h | 7 ------- src/hb-unicode.cc | 6 ------ src/hb-unicode.h | 3 --- test/test-unicode.c | 24 ------------------------ 10 files changed, 85 deletions(-) diff --git a/src/hb-blob.c b/src/hb-blob.c index 97ffd99f4..5419078ef 100644 --- a/src/hb-blob.c +++ b/src/hb-blob.c @@ -152,12 +152,6 @@ 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) { diff --git a/src/hb-blob.h b/src/hb-blob.h index b6080f1d5..4097ccc64 100644 --- a/src/hb-blob.h +++ b/src/hb-blob.h @@ -59,9 +59,6 @@ hb_blob_create_empty (void); 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); diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 2f7a173e3..5d3b5320a 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -154,12 +154,6 @@ hb_buffer_reference (hb_buffer_t *buffer) HB_OBJECT_DO_REFERENCE (buffer); } -unsigned int -hb_buffer_get_reference_count (hb_buffer_t *buffer) -{ - HB_OBJECT_DO_GET_REFERENCE_COUNT (buffer); -} - void hb_buffer_destroy (hb_buffer_t *buffer) { diff --git a/src/hb-buffer.h b/src/hb-buffer.h index d12faf8ea..b80ce9f96 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -65,9 +65,6 @@ hb_buffer_create (unsigned int pre_alloc_size); hb_buffer_t * hb_buffer_reference (hb_buffer_t *buffer); -unsigned int -hb_buffer_get_reference_count (hb_buffer_t *buffer); - void hb_buffer_destroy (hb_buffer_t *buffer); diff --git a/src/hb-font.cc b/src/hb-font.cc index 43112c11f..521120afd 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -115,12 +115,6 @@ hb_font_funcs_reference (hb_font_funcs_t *ffuncs) HB_OBJECT_DO_REFERENCE (ffuncs); } -unsigned int -hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs) -{ - HB_OBJECT_DO_GET_REFERENCE_COUNT (ffuncs); -} - void hb_font_funcs_destroy (hb_font_funcs_t *ffuncs) { @@ -397,12 +391,6 @@ 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) { @@ -477,12 +465,6 @@ 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) { diff --git a/src/hb-font.h b/src/hb-font.h index 4b9540b0c..29cd5cbd4 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -55,9 +55,6 @@ 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); @@ -94,9 +91,6 @@ hb_font_funcs_create (void); hb_font_funcs_t * hb_font_funcs_reference (hb_font_funcs_t *ffuncs); -unsigned int -hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs); - void hb_font_funcs_destroy (hb_font_funcs_t *ffuncs); @@ -209,9 +203,6 @@ hb_font_create (void); 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); diff --git a/src/hb-object-private.h b/src/hb-object-private.h index a5b535573..c1787c537 100644 --- a/src/hb-object-private.h +++ b/src/hb-object-private.h @@ -116,13 +116,6 @@ _hb_trace_object (const void *obj, return obj; \ } HB_STMT_END -#define HB_OBJECT_DO_GET_REFERENCE_COUNT(obj) \ - HB_STMT_START { \ - if (unlikely (!(obj) || 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 { \ int old_count; \ diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index ddad8849a..9295be7e4 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -128,12 +128,6 @@ hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs) HB_OBJECT_DO_REFERENCE (ufuncs); } -unsigned int -hb_unicode_funcs_get_reference_count (hb_unicode_funcs_t *ufuncs) -{ - HB_OBJECT_DO_GET_REFERENCE_COUNT (ufuncs); -} - void hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs) { diff --git a/src/hb-unicode.h b/src/hb-unicode.h index 0b94aa320..0fcef06fe 100644 --- a/src/hb-unicode.h +++ b/src/hb-unicode.h @@ -46,9 +46,6 @@ hb_unicode_funcs_create (hb_unicode_funcs_t *parent_funcs); hb_unicode_funcs_t * hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs); -unsigned int -hb_unicode_funcs_get_reference_count (hb_unicode_funcs_t *ufuncs); - void hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs); diff --git a/test/test-unicode.c b/test/test-unicode.c index 923c25041..b7a5702f8 100644 --- a/test/test-unicode.c +++ b/test/test-unicode.c @@ -35,7 +35,6 @@ test_nil (void) g_assert_cmpint (hb_unicode_get_script (uf, 'd'), ==, HB_SCRIPT_UNKNOWN); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); hb_unicode_funcs_destroy (uf); } @@ -45,10 +44,6 @@ test_glib (void) hb_unicode_funcs_t *uf = hb_glib_get_unicode_funcs (); g_assert_cmpint (hb_unicode_get_script (uf, 'd'), ==, HB_SCRIPT_LATIN); - - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 0); - hb_unicode_funcs_destroy (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 0); } static gboolean freed0, freed1; @@ -92,7 +87,6 @@ test_custom (void) g_assert_cmpint (hb_unicode_get_script (uf, 'a'), ==, HB_SCRIPT_LATIN); g_assert_cmpint (hb_unicode_get_script (uf, '0'), ==, HB_SCRIPT_UNKNOWN); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); g_assert (!freed0 && !freed1); hb_unicode_funcs_destroy (uf); g_assert (freed0 && !freed1); @@ -123,13 +117,10 @@ test_subclassing_nil (void) hb_unicode_funcs_t *uf, *aa; uf = hb_unicode_funcs_create (NULL); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); aa = hb_unicode_funcs_create (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 2); hb_unicode_funcs_destroy (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, unique_pointer1, free_up); @@ -137,8 +128,6 @@ test_subclassing_nil (void) g_assert_cmpint (hb_unicode_get_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmpint (hb_unicode_get_script (aa, 'b'), ==, HB_SCRIPT_UNKNOWN); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (aa), ==, 1); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); g_assert (!freed0 && !freed1); hb_unicode_funcs_destroy (aa); g_assert (!freed0 && freed1); @@ -151,13 +140,7 @@ test_subclassing_glib (void) hb_unicode_funcs_t *uf, *aa; uf = hb_glib_get_unicode_funcs (); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 0); - aa = hb_unicode_funcs_create (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 0); - - hb_unicode_funcs_destroy (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 0); hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, unique_pointer1, free_up); @@ -165,7 +148,6 @@ test_subclassing_glib (void) g_assert_cmpint (hb_unicode_get_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmpint (hb_unicode_get_script (aa, 'b'), ==, HB_SCRIPT_LATIN); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (aa), ==, 1); g_assert (!freed0 && !freed1); hb_unicode_funcs_destroy (aa); g_assert (!freed0 && freed1); @@ -178,17 +160,13 @@ test_subclassing_deep (void) hb_unicode_funcs_t *uf, *aa; uf = hb_unicode_funcs_create (NULL); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); hb_unicode_funcs_set_script_func (uf, simple_get_script, unique_pointer0, free_up); aa = hb_unicode_funcs_create (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (aa), ==, 1); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 2); hb_unicode_funcs_destroy (uf); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); /* make sure the 'uf' didn't get freed, since 'aa' holds a ref */ g_assert (!freed0); @@ -200,8 +178,6 @@ test_subclassing_deep (void) g_assert_cmpint (hb_unicode_get_script (aa, 'b'), ==, HB_SCRIPT_LATIN); g_assert_cmpint (hb_unicode_get_script (aa, '0'), ==, HB_SCRIPT_UNKNOWN); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (aa), ==, 1); - g_assert_cmpint (hb_unicode_funcs_get_reference_count (uf), ==, 1); g_assert (!freed0 && !freed1); hb_unicode_funcs_destroy (aa); g_assert (freed0 && freed1);