[API] Rename hb_face_get_table() to hb_face_reference_table()

That correctly reflects the reference ownership transfer happening.
This commit is contained in:
Behdad Esfahbod 2011-04-20 17:03:00 -04:00
parent 2d7b61a4b0
commit c035812feb
4 changed files with 8 additions and 11 deletions

View File

@ -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->ot_layout = _hb_ot_layout_new (face);
face->head_blob = Sanitizer<head>::sanitize (hb_face_get_table (face, HB_OT_TAG_head)); face->head_blob = Sanitizer<head>::sanitize (hb_face_reference_table (face, HB_OT_TAG_head));
face->head_table = Sanitizer<head>::lock_instance (face->head_blob); face->head_table = Sanitizer<head>::lock_instance (face->head_blob);
return face; return face;
@ -408,7 +408,7 @@ hb_face_destroy (hb_face_t *face)
} }
hb_blob_t * hb_blob_t *
hb_face_get_table (hb_face_t *face, hb_face_reference_table (hb_face_t *face,
hb_tag_t tag) hb_tag_t tag)
{ {
hb_blob_t *blob; hb_blob_t *blob;

View File

@ -67,12 +67,9 @@ hb_face_destroy (hb_face_t *face);
* table vs a zero-length table vs a very short table. It only leads to implementations * 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 * that check for non-NULL and assume that they've got a usable table going on... This
* actually happened with Firefox. * 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_blob_t *
hb_face_get_table (hb_face_t *face, hb_face_reference_table (hb_face_t *face,
hb_tag_t tag); hb_tag_t tag);
unsigned int unsigned int

View File

@ -47,13 +47,13 @@ _hb_ot_layout_new (hb_face_t *face)
/* Remove this object altogether */ /* Remove this object altogether */
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_get_table (face, HB_OT_TAG_GDEF)); layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GDEF));
layout->gdef = Sanitizer<GDEF>::lock_instance (layout->gdef_blob); layout->gdef = Sanitizer<GDEF>::lock_instance (layout->gdef_blob);
layout->gsub_blob = Sanitizer<GSUB>::sanitize (hb_face_get_table (face, HB_OT_TAG_GSUB)); layout->gsub_blob = Sanitizer<GSUB>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GSUB));
layout->gsub = Sanitizer<GSUB>::lock_instance (layout->gsub_blob); layout->gsub = Sanitizer<GSUB>::lock_instance (layout->gsub_blob);
layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_get_table (face, HB_OT_TAG_GPOS)); layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GPOS));
layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob); layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob);
return layout; return layout;

View File

@ -48,7 +48,7 @@ hb_shape_internal (hb_font_t *font,
{ {
#if 0 && defined(HAVE_GRAPHITE) #if 0 && defined(HAVE_GRAPHITE)
hb_blob_t *silf_blob; 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)) if (hb_blob_get_length(silf_blob))
{ {
hb_graphite_shape(font, face, buffer, features, num_features); hb_graphite_shape(font, face, buffer, features, num_features);