[minor] Add unlikely() when checking for error

This commit is contained in:
Behdad Esfahbod 2021-02-11 10:55:03 -07:00
parent eb069f3948
commit d7e2a51de2
3 changed files with 6 additions and 6 deletions

View File

@ -756,7 +756,7 @@ hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data;
hb_face_builder_data_t::table_entry_t *entry = data->tables.push ();
if (data->tables.in_error())
if (unlikely (data->tables.in_error()))
return false;
entry->tag = tag;

View File

@ -186,7 +186,7 @@ struct glyf
| hb_map (&SubsetGlyph::padded_size)
;
if (c->serializer->in_error ()) return_trace (false);
if (unlikely (c->serializer->in_error ())) return_trace (false);
return_trace (c->serializer->check_success (_add_loca_and_head (c->plan,
padded_offsets)));
}

View File

@ -89,7 +89,7 @@ struct hb_closure_context_t :
bool is_lookup_done (unsigned int lookup_index)
{
if (done_lookups->in_error ())
if (unlikely (done_lookups->in_error ()))
return true;
/* Have we visited this lookup with the current set of glyphs? */
@ -162,10 +162,10 @@ struct hb_closure_lookups_context_t :
bool is_lookup_visited (unsigned lookup_index)
{
if (lookup_count++ > HB_MAX_LOOKUP_INDICES)
if (unlikely (lookup_count++ > HB_MAX_LOOKUP_INDICES))
return true;
if (visited_lookups->in_error ())
if (unlikely (visited_lookups->in_error ()))
return true;
return visited_lookups->has (lookup_index);
@ -3397,7 +3397,7 @@ struct GSUBGPOS
hb_set_t alternate_feature_indices;
if (version.to_int () >= 0x00010001u)
(this+featureVars).closure_features (lookup_indices, &alternate_feature_indices);
if (alternate_feature_indices.in_error()) {
if (unlikely (alternate_feature_indices.in_error())) {
feature_indices->successful = false;
return;
}