Add hb_blob_ptr_t.destroy()

This commit is contained in:
Behdad Esfahbod 2018-11-11 11:40:57 -05:00
parent bb9abb4efd
commit da6aa3b033
11 changed files with 15 additions and 14 deletions

View File

@ -97,6 +97,7 @@ struct hb_blob_ptr_t
inline const T * get (void) const { return b->as<T> (); }
inline hb_blob_t * get_blob (void) const { return b.get_raw (); }
inline unsigned int get_length (void) const { return b.get ()->length; }
inline void destroy (void) { hb_blob_destroy (b.get ()); b = nullptr; }
hb_nonnull_ptr_t<hb_blob_t> b;
};

View File

@ -1050,7 +1050,7 @@ struct cmap
inline void fini (void)
{
hb_blob_destroy (this->table.get_blob ());
this->table.destroy ();
}
inline bool get_nominal_glyph (hb_codepoint_t unicode,

View File

@ -392,8 +392,8 @@ struct CBDT
inline void fini (void)
{
hb_blob_destroy (this->cblc.get_blob ());
hb_blob_destroy (this->cbdt.get_blob ());
this->cblc.destroy ();
this->cbdt.destroy ();
}
inline bool get_extents (hb_font_t *font, hb_codepoint_t glyph,

View File

@ -146,7 +146,7 @@ struct sbix
inline void fini (void)
{
hb_blob_destroy (table.get_blob ());
table.destroy ();
}
inline bool has_data () const

View File

@ -86,7 +86,7 @@ struct SVG
inline void fini (void)
{
hb_blob_destroy (table.get_blob ());
table.destroy ();
}
inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const

View File

@ -254,8 +254,8 @@ struct glyf
inline void fini (void)
{
hb_blob_destroy (loca_table.get_blob ());
hb_blob_destroy (glyf_table.get_blob ());
loca_table.destroy ();
glyf_table.destroy ();
}
/*

View File

@ -234,7 +234,7 @@ struct hmtxvmtx
if (unlikely (!num_advances))
{
num_metrics = num_advances = 0;
hb_blob_destroy (table.get_blob ());
table.destroy ();
table = hb_blob_get_empty ();
}
@ -243,8 +243,8 @@ struct hmtxvmtx
inline void fini (void)
{
hb_blob_destroy (table.get_blob ());
hb_blob_destroy (var_table.get_blob ());
table.destroy ();
var_table.destroy ();
}
/* TODO Add variations version. */

View File

@ -412,7 +412,7 @@ struct GDEF
inline void fini (void)
{
hb_blob_destroy (this->table.get_blob ());
this->table.destroy ();
}
hb_blob_ptr_t<GDEF> table;

View File

@ -2769,7 +2769,7 @@ struct GSUBGPOS
for (unsigned int i = 0; i < this->lookup_count; i++)
this->accels[i].fini ();
free (this->accels);
hb_blob_destroy (this->table.get_blob ());
this->table.destroy ();
}
hb_blob_ptr_t<T> table;

View File

@ -220,7 +220,7 @@ struct name
inline void fini (void)
{
this->names.fini ();
hb_blob_destroy (this->table.get_blob ());
this->table.destroy ();
}
inline int get_index (hb_ot_name_id_t name_id,

View File

@ -123,7 +123,7 @@ struct post
{
index_to_offset.fini ();
free (gids_sorted_by_name.get ());
hb_blob_destroy (table.get_blob ());
table.destroy ();
}
inline bool get_glyph_name (hb_codepoint_t glyph,