Replace most uses of is_inert with is_immutable

This commit is contained in:
Behdad Esfahbod 2018-11-03 15:03:06 -04:00
parent 0589787ff5
commit 93ef20a83b
5 changed files with 24 additions and 22 deletions

View File

@ -217,7 +217,7 @@ hb_buffer_t::get_scratch_buffer (unsigned int *size)
void void
hb_buffer_t::reset (void) hb_buffer_t::reset (void)
{ {
if (unlikely (hb_object_is_inert (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
hb_unicode_funcs_destroy (unicode); hb_unicode_funcs_destroy (unicode);
@ -232,7 +232,7 @@ hb_buffer_t::reset (void)
void void
hb_buffer_t::clear (void) hb_buffer_t::clear (void)
{ {
if (unlikely (hb_object_is_inert (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT; 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 void
hb_buffer_t::remove_output (void) hb_buffer_t::remove_output (void)
{ {
if (unlikely (hb_object_is_inert (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
have_output = false; have_output = false;
@ -302,7 +302,7 @@ hb_buffer_t::remove_output (void)
void void
hb_buffer_t::clear_output (void) hb_buffer_t::clear_output (void)
{ {
if (unlikely (hb_object_is_inert (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
have_output = true; have_output = true;
@ -315,7 +315,7 @@ hb_buffer_t::clear_output (void)
void void
hb_buffer_t::clear_positions (void) hb_buffer_t::clear_positions (void)
{ {
if (unlikely (hb_object_is_inert (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
have_output = false; have_output = false;
@ -873,7 +873,7 @@ void
hb_buffer_set_unicode_funcs (hb_buffer_t *buffer, hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
hb_unicode_funcs_t *unicode_funcs) hb_unicode_funcs_t *unicode_funcs)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
if (!unicode_funcs) if (!unicode_funcs)
@ -920,7 +920,7 @@ hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction) hb_direction_t direction)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->props.direction = direction; buffer->props.direction = direction;
@ -964,7 +964,7 @@ void
hb_buffer_set_script (hb_buffer_t *buffer, hb_buffer_set_script (hb_buffer_t *buffer,
hb_script_t script) hb_script_t script)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->props.script = script; buffer->props.script = script;
@ -1008,7 +1008,7 @@ void
hb_buffer_set_language (hb_buffer_t *buffer, hb_buffer_set_language (hb_buffer_t *buffer,
hb_language_t language) hb_language_t language)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->props.language = language; buffer->props.language = language;
@ -1046,7 +1046,7 @@ void
hb_buffer_set_segment_properties (hb_buffer_t *buffer, hb_buffer_set_segment_properties (hb_buffer_t *buffer,
const hb_segment_properties_t *props) const hb_segment_properties_t *props)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->props = *props; buffer->props = *props;
@ -1082,7 +1082,7 @@ void
hb_buffer_set_flags (hb_buffer_t *buffer, hb_buffer_set_flags (hb_buffer_t *buffer,
hb_buffer_flags_t flags) hb_buffer_flags_t flags)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->flags = flags; buffer->flags = flags;
@ -1118,7 +1118,7 @@ void
hb_buffer_set_cluster_level (hb_buffer_t *buffer, hb_buffer_set_cluster_level (hb_buffer_t *buffer,
hb_buffer_cluster_level_t cluster_level) hb_buffer_cluster_level_t cluster_level)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->cluster_level = cluster_level; buffer->cluster_level = cluster_level;
@ -1157,7 +1157,7 @@ void
hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer, hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
hb_codepoint_t replacement) hb_codepoint_t replacement)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->replacement = replacement; buffer->replacement = replacement;
@ -1197,7 +1197,7 @@ void
hb_buffer_set_invisible_glyph (hb_buffer_t *buffer, hb_buffer_set_invisible_glyph (hb_buffer_t *buffer,
hb_codepoint_t invisible) hb_codepoint_t invisible)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return; return;
buffer->invisible = invisible; buffer->invisible = invisible;
@ -1329,7 +1329,7 @@ hb_bool_t
hb_buffer_set_length (hb_buffer_t *buffer, hb_buffer_set_length (hb_buffer_t *buffer,
unsigned int length) unsigned int length)
{ {
if (unlikely (hb_object_is_inert (buffer))) if (unlikely (hb_object_is_immutable (buffer)))
return length == 0; return length == 0;
if (!buffer->ensure (length)) 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 || assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
(!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); (!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; return;
if (text_length == -1) if (text_length == -1)

View File

@ -353,7 +353,7 @@ hb_coretext_font_create (CTFontRef ct_font)
hb_font_t *font = hb_font_create (face); hb_font_t *font = hb_font_create (face);
hb_face_destroy (face); hb_face_destroy (face);
if (unlikely (hb_object_is_inert (font))) if (unlikely (hb_object_is_immutable (font)))
return font; return font;
hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font))); hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));

View File

@ -1377,7 +1377,7 @@ hb_font_create_sub_font (hb_font_t *parent)
hb_font_t *font = _hb_font_create (parent->face); 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; return font;
font->parent = hb_font_reference (parent); font->parent = hb_font_reference (parent);

View File

@ -225,15 +225,17 @@ struct hb_set_t
return true; return true;
} }
inline void clear (void) { inline void clear (void)
if (unlikely (hb_object_is_inert (this))) {
if (unlikely (hb_object_is_immutable (this)))
return; return;
successful = true; successful = true;
population = 0; population = 0;
page_map.resize (0); page_map.resize (0);
pages.resize (0); pages.resize (0);
} }
inline bool is_empty (void) const { inline bool is_empty (void) const
{
unsigned int count = pages.len; unsigned int count = pages.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (!pages[i].is_empty ()) if (!pages[i].is_empty ())

View File

@ -343,7 +343,7 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
if (unlikely (!buffer->len)) if (unlikely (!buffer->len))
return true; return true;
assert (!hb_object_is_inert (buffer)); assert (!hb_object_is_immutable (buffer));
assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE);
if (unlikely (hb_object_is_inert (shape_plan))) if (unlikely (hb_object_is_inert (shape_plan)))