From 93ef20a83b31e6528bb1835d2b4b83b913805885 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Nov 2018 15:03:06 -0400 Subject: [PATCH] Replace most uses of is_inert with is_immutable --- src/hb-buffer.cc | 32 ++++++++++++++++---------------- src/hb-coretext.cc | 2 +- src/hb-font.cc | 2 +- src/hb-set.hh | 8 +++++--- src/hb-shape-plan.cc | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 5a8152ed4..1a5547b35 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -217,7 +217,7 @@ hb_buffer_t::get_scratch_buffer (unsigned int *size) void hb_buffer_t::reset (void) { - if (unlikely (hb_object_is_inert (this))) + if (unlikely (hb_object_is_immutable (this))) return; hb_unicode_funcs_destroy (unicode); @@ -232,7 +232,7 @@ hb_buffer_t::reset (void) void hb_buffer_t::clear (void) { - if (unlikely (hb_object_is_inert (this))) + if (unlikely (hb_object_is_immutable (this))) return; hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT; @@ -289,7 +289,7 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info) void hb_buffer_t::remove_output (void) { - if (unlikely (hb_object_is_inert (this))) + if (unlikely (hb_object_is_immutable (this))) return; have_output = false; @@ -302,7 +302,7 @@ hb_buffer_t::remove_output (void) void hb_buffer_t::clear_output (void) { - if (unlikely (hb_object_is_inert (this))) + if (unlikely (hb_object_is_immutable (this))) return; have_output = true; @@ -315,7 +315,7 @@ hb_buffer_t::clear_output (void) void hb_buffer_t::clear_positions (void) { - if (unlikely (hb_object_is_inert (this))) + if (unlikely (hb_object_is_immutable (this))) return; have_output = false; @@ -873,7 +873,7 @@ void hb_buffer_set_unicode_funcs (hb_buffer_t *buffer, hb_unicode_funcs_t *unicode_funcs) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; if (!unicode_funcs) @@ -920,7 +920,7 @@ hb_buffer_set_direction (hb_buffer_t *buffer, hb_direction_t direction) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->props.direction = direction; @@ -964,7 +964,7 @@ void hb_buffer_set_script (hb_buffer_t *buffer, hb_script_t script) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->props.script = script; @@ -1008,7 +1008,7 @@ void hb_buffer_set_language (hb_buffer_t *buffer, hb_language_t language) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->props.language = language; @@ -1046,7 +1046,7 @@ void hb_buffer_set_segment_properties (hb_buffer_t *buffer, const hb_segment_properties_t *props) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->props = *props; @@ -1082,7 +1082,7 @@ void hb_buffer_set_flags (hb_buffer_t *buffer, hb_buffer_flags_t flags) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->flags = flags; @@ -1118,7 +1118,7 @@ void hb_buffer_set_cluster_level (hb_buffer_t *buffer, hb_buffer_cluster_level_t cluster_level) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->cluster_level = cluster_level; @@ -1157,7 +1157,7 @@ void hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer, hb_codepoint_t replacement) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->replacement = replacement; @@ -1197,7 +1197,7 @@ void hb_buffer_set_invisible_glyph (hb_buffer_t *buffer, hb_codepoint_t invisible) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; buffer->invisible = invisible; @@ -1329,7 +1329,7 @@ hb_bool_t hb_buffer_set_length (hb_buffer_t *buffer, unsigned int length) { - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return length == 0; if (!buffer->ensure (length)) @@ -1535,7 +1535,7 @@ hb_buffer_add_utf (hb_buffer_t *buffer, assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); - if (unlikely (hb_object_is_inert (buffer))) + if (unlikely (hb_object_is_immutable (buffer))) return; if (text_length == -1) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 184db4944..893a8761d 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -353,7 +353,7 @@ hb_coretext_font_create (CTFontRef ct_font) hb_font_t *font = hb_font_create (face); hb_face_destroy (face); - if (unlikely (hb_object_is_inert (font))) + if (unlikely (hb_object_is_immutable (font))) return font; hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font))); diff --git a/src/hb-font.cc b/src/hb-font.cc index 567cdedc0..b24995b12 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1377,7 +1377,7 @@ hb_font_create_sub_font (hb_font_t *parent) hb_font_t *font = _hb_font_create (parent->face); - if (unlikely (hb_object_is_inert (font))) + if (unlikely (hb_object_is_immutable (font))) return font; font->parent = hb_font_reference (parent); diff --git a/src/hb-set.hh b/src/hb-set.hh index 947e8d9d1..21a22525f 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -225,15 +225,17 @@ struct hb_set_t return true; } - inline void clear (void) { - if (unlikely (hb_object_is_inert (this))) + inline void clear (void) + { + if (unlikely (hb_object_is_immutable (this))) return; successful = true; population = 0; page_map.resize (0); pages.resize (0); } - inline bool is_empty (void) const { + inline bool is_empty (void) const + { unsigned int count = pages.len; for (unsigned int i = 0; i < count; i++) if (!pages[i].is_empty ()) diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index 4648cc757..8d002f8a7 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -343,7 +343,7 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan, if (unlikely (!buffer->len)) return true; - assert (!hb_object_is_inert (buffer)); + assert (!hb_object_is_immutable (buffer)); assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); if (unlikely (hb_object_is_inert (shape_plan)))