From 217ed5e3c885532fa8b332cc0d0f9cb4eef32e2b Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 7 Feb 2018 16:30:07 -0800 Subject: [PATCH] Cleanups in hb-subset-glyf and hb-subset-plan. --- src/hb-subset-glyf.cc | 30 +++++++++++++++--------------- src/hb-subset-plan.hh | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index 6581754b..24256454 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -30,15 +30,15 @@ #include "hb-subset-glyf.hh" bool -calculate_glyf_prime_size (const OT::glyf::accelerator_t &glyf, - hb_set_t *glyph_ids, - unsigned int *size /* OUT */) +_calculate_glyf_prime_size (const OT::glyf::accelerator_t &glyf, + hb_set_t *glyph_ids, + unsigned int *size /* OUT */) { unsigned int total = 0; hb_codepoint_t next_glyph = -1; while (hb_set_next(glyph_ids, &next_glyph)) { unsigned int start_offset, end_offset; - if (!glyf.get_offsets (next_glyph, &start_offset, &end_offset)) { + if (unlikely (!glyf.get_offsets (next_glyph, &start_offset, &end_offset))) { *size = 0; return false; } @@ -51,18 +51,18 @@ calculate_glyf_prime_size (const OT::glyf::accelerator_t &glyf, } bool -write_glyf_prime (const OT::glyf::accelerator_t &glyf, - const char *glyf_data, - hb_set_t *glyph_ids, - int glyf_prime_size, - char *glyf_prime_data /* OUT */) +_write_glyf_prime (const OT::glyf::accelerator_t &glyf, + const char *glyf_data, + hb_set_t *glyph_ids, + int glyf_prime_size, + char *glyf_prime_data /* OUT */) { char *glyf_prime_data_next = glyf_prime_data; hb_codepoint_t next_glyph = -1; while (hb_set_next(glyph_ids, &next_glyph)) { unsigned int start_offset, end_offset; - if (!glyf.get_offsets (next_glyph, &start_offset, &end_offset)) { + if (unlikely (!glyf.get_offsets (next_glyph, &start_offset, &end_offset))) { return false; } @@ -85,15 +85,15 @@ _hb_subset_glyf (const OT::glyf::accelerator_t &glyf, // TODO(grieger): Subset loca simultaneously. unsigned int glyf_prime_size; - if (!calculate_glyf_prime_size (glyf, - glyphs_to_retain, - &glyf_prime_size)) { + if (unlikely (!_calculate_glyf_prime_size (glyf, + glyphs_to_retain, + &glyf_prime_size))) { return false; } char *glyf_prime_data = (char *) calloc (glyf_prime_size, 1); - if (!write_glyf_prime (glyf, glyf_data, glyphs_to_retain, glyf_prime_size, - glyf_prime_data)) { + if (unlikely (!_write_glyf_prime (glyf, glyf_data, glyphs_to_retain, glyf_prime_size, + glyf_prime_data))) { free (glyf_prime_data); return false; } diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index b1ed1add..1e572a43 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -55,4 +55,4 @@ hb_subset_plan_get_empty (); void hb_subset_plan_destroy (hb_subset_plan_t *plan); -#endif /* HB_SUBSET_PLAN_PRIVATE_HH */ +#endif /* HB_SUBSET_PLAN_HH */ -- GitLab