diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 3c54f7243..0e293f6b5 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -218,9 +218,6 @@ hb_buffer_t::get_scratch_buffer (unsigned int *size) void hb_buffer_t::reset () { - if (unlikely (hb_object_is_immutable (this))) - return; - hb_unicode_funcs_destroy (unicode); unicode = hb_unicode_funcs_reference (hb_unicode_funcs_get_default ()); flags = HB_BUFFER_FLAG_DEFAULT; @@ -233,9 +230,6 @@ hb_buffer_t::reset () void hb_buffer_t::clear () { - if (unlikely (hb_object_is_immutable (this))) - return; - hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT; props = default_props; scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT; @@ -290,9 +284,6 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info) void hb_buffer_t::remove_output () { - if (unlikely (hb_object_is_immutable (this))) - return; - have_output = false; have_positions = false; @@ -303,9 +294,6 @@ hb_buffer_t::remove_output () void hb_buffer_t::clear_output () { - if (unlikely (hb_object_is_immutable (this))) - return; - have_output = true; have_positions = false; @@ -316,9 +304,6 @@ hb_buffer_t::clear_output () void hb_buffer_t::clear_positions () { - if (unlikely (hb_object_is_immutable (this))) - return; - have_output = false; have_positions = true; @@ -1226,6 +1211,9 @@ hb_buffer_get_invisible_glyph (hb_buffer_t *buffer) void hb_buffer_reset (hb_buffer_t *buffer) { + if (unlikely (hb_object_is_immutable (buffer))) + return; + buffer->reset (); } @@ -1241,6 +1229,9 @@ hb_buffer_reset (hb_buffer_t *buffer) void hb_buffer_clear_contents (hb_buffer_t *buffer) { + if (unlikely (hb_object_is_immutable (buffer))) + return; + buffer->clear (); } diff --git a/src/hb-map.cc b/src/hb-map.cc index aabf713d5..f115da2bb 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -253,6 +253,9 @@ hb_map_has (const hb_map_t *map, void hb_map_clear (hb_map_t *map) { + if (unlikely (hb_object_is_immutable (map))) + return; + return map->clear (); } diff --git a/src/hb-map.hh b/src/hb-map.hh index 92c1bd67e..82fa3ccf8 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -97,8 +97,6 @@ struct hb_hashmap_t void reset () { - if (unlikely (hb_object_is_immutable (this))) - return; successful = true; clear (); } @@ -171,8 +169,6 @@ struct hb_hashmap_t void clear () { - if (unlikely (hb_object_is_immutable (this))) - return; if (items) for (auto &_ : hb_iter (items, mask + 1)) _.clear (); diff --git a/src/hb-set.cc b/src/hb-set.cc index 55e3b9025..86bf70034 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -183,6 +183,9 @@ hb_set_allocation_successful (const hb_set_t *set) void hb_set_clear (hb_set_t *set) { + if (unlikely (hb_object_is_immutable (set))) + return; + set->clear (); } diff --git a/src/hb-set.hh b/src/hb-set.hh index c524b5d31..3b100f609 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -256,17 +256,12 @@ struct hb_set_t void reset () { - if (unlikely (hb_object_is_immutable (this))) - return; successful = true; clear (); } void clear () { - if (unlikely (hb_object_is_immutable (this))) - return; - if (resize (0)) population = 0; }