diff --git a/src/hb-blob.hh b/src/hb-blob.hh index 1b7d4bed9..802b1f07e 100644 --- a/src/hb-blob.hh +++ b/src/hb-blob.hh @@ -97,6 +97,7 @@ struct hb_blob_ptr_t inline const T * get (void) const { return b->as (); } 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 b; }; diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 8d94ad312..4c24cb99c 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -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, diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index 0a8f4e1ab..47774fd8f 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -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, diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 64ebb63e9..80d65022c 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -146,7 +146,7 @@ struct sbix inline void fini (void) { - hb_blob_destroy (table.get_blob ()); + table.destroy (); } inline bool has_data () const diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index 37b28ea68..bad8ef549 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -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 diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 43b921e2c..42bb03ff8 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -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 (); } /* diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 7a1eb799a..20948edbf 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -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. */ diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index aa6ffc884..e6804e6b5 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -412,7 +412,7 @@ struct GDEF inline void fini (void) { - hb_blob_destroy (this->table.get_blob ()); + this->table.destroy (); } hb_blob_ptr_t table; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 2a89d495e..1335601a3 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -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 table; diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 5aa068136..ab07b7196 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -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, diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 485058144..557fefada 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -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,