From c035812feb0d385a9e8c334631738e4915912c71 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 20 Apr 2011 17:03:00 -0400 Subject: [PATCH] [API] Rename hb_face_get_table() to hb_face_reference_table() That correctly reflects the reference ownership transfer happening. --- src/hb-font.cc | 4 ++-- src/hb-font.h | 7 ++----- src/hb-ot-layout.cc | 6 +++--- src/hb-shape.cc | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index 521120a..2475089 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -319,7 +319,7 @@ hb_face_create_for_tables (hb_get_table_func_t get_table, face->ot_layout = _hb_ot_layout_new (face); - face->head_blob = Sanitizer::sanitize (hb_face_get_table (face, HB_OT_TAG_head)); + face->head_blob = Sanitizer::sanitize (hb_face_reference_table (face, HB_OT_TAG_head)); face->head_table = Sanitizer::lock_instance (face->head_blob); return face; @@ -408,7 +408,7 @@ hb_face_destroy (hb_face_t *face) } hb_blob_t * -hb_face_get_table (hb_face_t *face, +hb_face_reference_table (hb_face_t *face, hb_tag_t tag) { hb_blob_t *blob; diff --git a/src/hb-font.h b/src/hb-font.h index 29cd5cb..397b586 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -67,13 +67,10 @@ hb_face_destroy (hb_face_t *face); * table vs a zero-length table vs a very short table. It only leads to implementations * that check for non-NULL and assume that they've got a usable table going on... This * actually happened with Firefox. - * - * - It has to be renamed to reference_table() since unlike any other _get_ API, a reference - * ownership transfer happens and the user is responsible to destroy the result. */ hb_blob_t * -hb_face_get_table (hb_face_t *face, - hb_tag_t tag); +hb_face_reference_table (hb_face_t *face, + hb_tag_t tag); unsigned int hb_face_get_upem (hb_face_t *face); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index f1287c5..7990fe9 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -47,13 +47,13 @@ _hb_ot_layout_new (hb_face_t *face) /* Remove this object altogether */ hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); - layout->gdef_blob = Sanitizer::sanitize (hb_face_get_table (face, HB_OT_TAG_GDEF)); + layout->gdef_blob = Sanitizer::sanitize (hb_face_reference_table (face, HB_OT_TAG_GDEF)); layout->gdef = Sanitizer::lock_instance (layout->gdef_blob); - layout->gsub_blob = Sanitizer::sanitize (hb_face_get_table (face, HB_OT_TAG_GSUB)); + layout->gsub_blob = Sanitizer::sanitize (hb_face_reference_table (face, HB_OT_TAG_GSUB)); layout->gsub = Sanitizer::lock_instance (layout->gsub_blob); - layout->gpos_blob = Sanitizer::sanitize (hb_face_get_table (face, HB_OT_TAG_GPOS)); + layout->gpos_blob = Sanitizer::sanitize (hb_face_reference_table (face, HB_OT_TAG_GPOS)); layout->gpos = Sanitizer::lock_instance (layout->gpos_blob); return layout; diff --git a/src/hb-shape.cc b/src/hb-shape.cc index 2b536fa..9d5d418 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -48,7 +48,7 @@ hb_shape_internal (hb_font_t *font, { #if 0 && defined(HAVE_GRAPHITE) hb_blob_t *silf_blob; - silf_blob = hb_face_get_table (face, HB_GRAPHITE_TAG_Silf); + silf_blob = hb_face_reference_table (face, HB_GRAPHITE_TAG_Silf); if (hb_blob_get_length(silf_blob)) { hb_graphite_shape(font, face, buffer, features, num_features); -- 2.7.4