src/hb-coretext.cc | 8 ++++---- src/hb-map.hh | 6 ++++++ src/hb-ot-cmap-table.hh | 14 ++++++++------ src/hb-ot-layout-common.hh | 4 +--- src/hb-ot-layout-gpos-table.hh | 2 +- src/hb-ot-layout-gsub-table.hh | 34 +++++++++++++++++----------------- src/hb-ot-layout-gsubgpos.hh | 10 +++++----- src/hb-ot-layout.cc | 10 +++++----- src/hb-set.hh | 5 +++++ src/hb-subset-plan.cc | 2 +- src/hb-subset.cc | 2 +- src/hb-uniscribe.cc | 12 ++++++------ src/hb-vector.hh | 37 ++++++++++++++++++++----------------- src/hb.hh | 12 ++++++++++++ 14 files changed, 92 insertions(+), 66 deletions(-)
New commits: commit 56e0fd345c4e68753123a05cd80291e933d71061 Author: Behdad Esfahbod <beh...@behdad.org> Date: Mon Oct 29 22:35:44 2018 -0700 Remove last use of hb_auto_t<> diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 86f9d2ca..a1c5a974 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -228,6 +228,10 @@ struct CmapSubtableFormat4 struct accelerator_t { + inline accelerator_t (void) {} + inline accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); } + inline ~accelerator_t (void) { fini (); } + inline void init (const CmapSubtableFormat4 *subtable) { segCount = subtable->segCountX2 / 2; @@ -327,12 +331,12 @@ struct CmapSubtableFormat4 inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - hb_auto_t<accelerator_t> accel (this); + accelerator_t accel (this); return accel.get_glyph_func (&accel, codepoint, glyph); } inline void collect_unicodes (hb_set_t *out) const { - hb_auto_t<accelerator_t> accel (this); + accelerator_t accel (this); accel.collect_unicodes (out); } commit ca5e5a4979fa4aca873ba986e60b3010aaf0b1de Author: Behdad Esfahbod <beh...@behdad.org> Date: Mon Oct 29 22:30:21 2018 -0700 Port Coverage::Iter off hb_auto_t<> diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 11297a57..47731053 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -1108,8 +1108,7 @@ struct Coverage struct Iter { - Iter (void) : format (0), u () {}; - inline void init (const Coverage &c_) + inline Iter (const Coverage &c_) { format = c_.u.format; switch (format) @@ -1119,7 +1118,6 @@ struct Coverage default: return; } } - inline void fini (void) {} inline bool more (void) { switch (format) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 8a6c0278..399ede43 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -719,7 +719,7 @@ struct PairPosFormat1 inline bool intersects (const hb_set_t *glyphs) const { unsigned int count = pairSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 10f4ca24..d24ea59a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -48,7 +48,7 @@ struct SingleSubstFormat1 inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -62,7 +62,7 @@ struct SingleSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -113,7 +113,7 @@ struct SingleSubstFormat1 hb_vector_t<GlyphID> from; hb_vector_t<GlyphID> to; hb_codepoint_t delta = deltaGlyphID; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (!c->plan->glyphset->has (iter.get_glyph ())) continue; @@ -157,7 +157,7 @@ struct SingleSubstFormat2 { TRACE_CLOSURE (this); unsigned int count = substitute.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -171,7 +171,7 @@ struct SingleSubstFormat2 TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = substitute.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -218,7 +218,7 @@ struct SingleSubstFormat2 TRACE_SUBSET (this); hb_vector_t<GlyphID> from; hb_vector_t<GlyphID> to; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (!c->plan->glyphset->has (iter.get_glyph ())) continue; @@ -395,7 +395,7 @@ struct MultipleSubstFormat1 { TRACE_CLOSURE (this); unsigned int count = sequence.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -585,7 +585,7 @@ struct AlternateSubstFormat1 { TRACE_CLOSURE (this); unsigned int count = alternateSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -599,7 +599,7 @@ struct AlternateSubstFormat1 TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = alternateSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -906,7 +906,7 @@ struct LigatureSubstFormat1 inline bool intersects (const hb_set_t *glyphs) const { unsigned int count = ligatureSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -921,7 +921,7 @@ struct LigatureSubstFormat1 { TRACE_CLOSURE (this); unsigned int count = ligatureSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -935,7 +935,7 @@ struct LigatureSubstFormat1 TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = ligatureSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -1114,7 +1114,7 @@ struct ReverseChainSingleSubstFormat1 const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead); count = substitute.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 09f64258..03fdac2a 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -1441,7 +1441,7 @@ struct ContextFormat1 }; unsigned int count = ruleSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -1462,7 +1462,7 @@ struct ContextFormat1 }; unsigned int count = ruleSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -2105,7 +2105,7 @@ struct ChainContextFormat1 }; unsigned int count = ruleSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -2126,7 +2126,7 @@ struct ChainContextFormat1 }; unsigned int count = ruleSet.len; - for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + for (Coverage::Iter iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ commit 3a4e5dd425a2a37ff4c37db953943386c0b6e5d8 Author: Behdad Esfahbod <beh...@behdad.org> Date: Mon Oct 29 18:05:25 2018 -0700 Remove a few unnecessary hb_auto_t<>'s See a85641446c30247c4e948263f0f8c1147ed4efb9 diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 8b4f7e6a..184db494 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -474,8 +474,8 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, buffer->merge_clusters (i - 1, i + 1); } - hb_auto_t<hb_vector_t<feature_record_t> > feature_records; - hb_auto_t<hb_vector_t<range_record_t> > range_records; + hb_vector_t<feature_record_t> feature_records; + hb_vector_t<range_record_t> range_records; /* * Set up features. @@ -484,7 +484,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, if (num_features) { /* Sort features by start/end events. */ - hb_auto_t<hb_vector_t<feature_event_t> > feature_events; + hb_vector_t<feature_event_t> feature_events; for (unsigned int i = 0; i < num_features; i++) { const hb_aat_feature_mapping_t * mapping = hb_aat_layout_find_feature_mapping (features[i].tag); @@ -523,7 +523,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, } /* Scan events and save features for each range. */ - hb_auto_t<hb_vector_t<active_feature_t> > active_features; + hb_vector_t<active_feature_t> active_features; unsigned int last_index = 0; for (unsigned int i = 0; i < feature_events.len; i++) { diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index f0dbef69..86f9d2ca 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -859,10 +859,8 @@ struct cmap + CmapSubtableFormat12::get_sub_table_size (this->format12_groups); } - // Format 4 - hb_auto_t<hb_vector_t<CmapSubtableFormat4::segment_plan> > format4_segments; - // Format 12 - hb_auto_t<hb_vector_t<CmapSubtableLongGroup> > format12_groups; + hb_vector_t<CmapSubtableFormat4::segment_plan> format4_segments; + hb_vector_t<CmapSubtableLongGroup> format12_groups; }; inline bool sanitize (hb_sanitize_context_t *c) const diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 2ce52a1b..10f4ca24 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -110,8 +110,8 @@ struct SingleSubstFormat1 inline bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - hb_auto_t<hb_vector_t<GlyphID> > from; - hb_auto_t<hb_vector_t<GlyphID> > to; + hb_vector_t<GlyphID> from; + hb_vector_t<GlyphID> to; hb_codepoint_t delta = deltaGlyphID; for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { @@ -216,8 +216,8 @@ struct SingleSubstFormat2 inline bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); - hb_auto_t<hb_vector_t<GlyphID> > from; - hb_auto_t<hb_vector_t<GlyphID> > to; + hb_vector_t<GlyphID> from; + hb_vector_t<GlyphID> to; for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (!c->plan->glyphset->has (iter.get_glyph ())) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index a4066265..09f64258 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -93,7 +93,7 @@ struct hb_closure_context_t : hb_face_t *face; hb_set_t *glyphs; - hb_auto_t<hb_set_t> out[1]; + hb_set_t out[1]; recurse_func_t recurse_func; unsigned int nesting_level_left; unsigned int debug_depth; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 19f80040..ea59b835 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -708,8 +708,8 @@ struct hb_collect_features_context_t hb_set_t *feature_indexes; private: - hb_auto_t<hb_set_t> visited_script; - hb_auto_t<hb_set_t> visited_langsys; + hb_set_t visited_script; + hb_set_t visited_langsys; }; static void @@ -836,7 +836,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face, { const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); - hb_auto_t<hb_set_t> feature_indexes; + hb_set_t feature_indexes; hb_ot_layout_collect_features (face, table_tag, scripts, languages, features, &feature_indexes); for (hb_codepoint_t feature_index = HB_SET_VALUE_INVALID; @@ -974,7 +974,7 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face, unsigned int lookup_index, hb_set_t *glyphs) { - hb_auto_t<hb_map_t> done_lookups; + hb_map_t done_lookups; OT::hb_closure_context_t c (face, glyphs, &done_lookups); const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index); @@ -995,7 +995,7 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face, const hb_set_t *lookups, hb_set_t *glyphs) { - hb_auto_t<hb_map_t> done_lookups; + hb_map_t done_lookups; OT::hb_closure_context_t c (face, glyphs, &done_lookups); const OT::GSUB& gsub = _get_gsub (face); diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 05700603..64c8ad79 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -55,7 +55,7 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf, static void _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) { - hb_auto_t<hb_set_t> lookup_indices; + hb_set_t lookup_indices; hb_ot_layout_collect_lookups (face, HB_OT_TAG_GSUB, nullptr, diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 294fd846..ed61c628 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -68,7 +68,7 @@ _subset2 (hb_subset_plan_t *plan) hb_bool_t result = false; if (source_blob->data) { - hb_auto_t<hb_vector_t<char> > buf; + hb_vector_t<char> buf; unsigned int buf_size = _plan_estimate_subset_table_size (plan, source_blob->length); DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG(tag), buf_size); if (unlikely (!buf.alloc (buf_size))) diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index b12a0539..26b99ed1 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -642,12 +642,12 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, /* * Set up features. */ - hb_auto_t<hb_vector_t<OPENTYPE_FEATURE_RECORD> > feature_records; - hb_auto_t<hb_vector_t<range_record_t> > range_records; + hb_vector_t<OPENTYPE_FEATURE_RECORD> feature_records; + hb_vector_t<range_record_t> range_records; if (num_features) { /* Sort features by start/end events. */ - hb_auto_t<hb_vector_t<feature_event_t> > feature_events; + hb_vector_t<feature_event_t> feature_events; for (unsigned int i = 0; i < num_features; i++) { active_feature_t feature; @@ -682,7 +682,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan, } /* Scan events and save features for each range. */ - hb_auto_t<hb_vector_t<active_feature_t> > active_features; + hb_vector_t<active_feature_t> active_features; unsigned int last_index = 0; for (unsigned int i = 0; i < feature_events.len; i++) { @@ -854,8 +854,8 @@ retry: #undef MAX_ITEMS OPENTYPE_TAG language_tag = hb_uint32_swap (hb_ot_tag_from_language (buffer->props.language)); - hb_auto_t<hb_vector_t<TEXTRANGE_PROPERTIES*> > range_properties; - hb_auto_t<hb_vector_t<int> > range_char_counts; + hb_vector_t<TEXTRANGE_PROPERTIES*> range_properties; + hb_vector_t<int> range_char_counts; unsigned int glyphs_offset = 0; unsigned int glyphs_len; commit 67a22f377dee0dbd89f301f0a1fec6f787867b5e Author: Behdad Esfahbod <beh...@behdad.org> Date: Mon Oct 29 17:37:41 2018 -0700 [set/map/vector] Make constructable, but not copy or assignable Disable copy/assign on them, as they shouldn't. Make constructor / destructor call init_shallow/fini_shallow, and make those idempotent. So, these three can be constructed on stack now and no init/fini call is needed. As such, hb_auto_t<> is not needed anymore. I'll remove that separately. diff --git a/src/hb-map.hh b/src/hb-map.hh index b55e3a95..e5ca3f51 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -44,6 +44,10 @@ inline uint32_t Hash (const T &v) struct hb_map_t { + HB_NO_COPY_ASSIGN (hb_map_t); + inline hb_map_t (void) { init_shallow (); } + inline ~hb_map_t (void) { fini_shallow (); } + struct item_t { hb_codepoint_t key; @@ -77,9 +81,11 @@ struct hb_map_t inline void fini_shallow (void) { free (items); + items = nullptr; } inline void fini (void) { + population = occupancy = 0; hb_object_fini (this); fini_shallow (); } diff --git a/src/hb-set.hh b/src/hb-set.hh index 2071196b..97ff291e 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -39,6 +39,10 @@ struct hb_set_t { + HB_NO_COPY_ASSIGN (hb_set_t); + inline hb_set_t (void) { init_shallow (); } + inline ~hb_set_t (void) { fini_shallow (); } + struct page_map_t { inline int cmp (const page_map_t *o) const { return (int) o->major - (int) major; } @@ -199,6 +203,7 @@ struct hb_set_t } inline void fini_shallow (void) { + population = 0; page_map.fini (); pages.fini (); } diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 8995ae10..fe06addf 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -34,6 +34,10 @@ template <typename Type, unsigned int StaticSize=8> struct hb_vector_t { + HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, StaticSize); + inline hb_vector_t (void) { init (); } + inline ~hb_vector_t (void) { fini (); } + unsigned int len; private: unsigned int allocated; /* == 0 means allocation failed. */ @@ -48,6 +52,22 @@ struct hb_vector_t arrayZ_ = nullptr; } + inline void fini (void) + { + if (arrayZ_) + free (arrayZ_); + arrayZ_ = nullptr; + allocated = len = 0; + } + inline void fini_deep (void) + { + Type *array = arrayZ(); + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + array[i].fini (); + fini (); + } + inline Type * arrayZ (void) { return arrayZ_ ? arrayZ_ : static_array; } inline const Type * arrayZ (void) const @@ -255,23 +275,6 @@ struct hb_vector_t *i = max; return false; } - - inline void fini_deep (void) - { - Type *array = arrayZ(); - unsigned int count = len; - for (unsigned int i = 0; i < count; i++) - array[i].fini (); - fini (); - } - - inline void fini (void) - { - if (arrayZ_) - free (arrayZ_); - arrayZ_ = nullptr; - allocated = len = 0; - } }; diff --git a/src/hb.hh b/src/hb.hh index 74dd8ace..6f5d6aab 100644 --- a/src/hb.hh +++ b/src/hb.hh @@ -339,6 +339,16 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); #if __cplusplus >= 201103L +/* We only enable these with C++11 or later, since earlier language + * does not allow structs with constructors in unions, and we need + * those. */ + +#define HB_NO_COPY_ASSIGN(TypeName) \ + TypeName(const TypeName&); \ + void operator=(const TypeName&) +#define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) \ + TypeName(const TypeName<T1, T2>&); \ + void operator=(const TypeName<T1, T2>&) #define HB_NO_CREATE_COPY_ASSIGN(TypeName) \ TypeName(void); \ TypeName(const TypeName&); \ @@ -354,6 +364,8 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); #else /* __cpluspplus >= 201103L */ +#define HB_NO_COPY_ASSIGN(TypeName) +#define HB_NO_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) #define HB_NO_CREATE_COPY_ASSIGN(TypeName) #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE(TypeName, T) #define HB_NO_CREATE_COPY_ASSIGN_TEMPLATE2(TypeName, T1, T2) _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz