From e541fb474cc948659855dee9374946829de14581 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sun, 21 Jun 2020 09:49:48 +0430 Subject: [PATCH] minor, replace single hb_apply daggers with foreach --- src/hb-map.hh | 10 ++++------ src/hb-ot-hmtx-table.hh | 36 +++++++++++++++++------------------- src/hb-ot-math-table.hh | 15 ++++++--------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/hb-map.hh b/src/hb-map.hh index b7bf7fe59..1635b4a62 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -117,9 +117,8 @@ struct hb_hashmap_t successful = false; return false; } - + hb_iter (new_items, new_size) - | hb_apply (&item_t::clear) - ; + for (auto &_ : hb_iter (new_items, new_size)) + _.clear (); unsigned int old_size = mask + 1; item_t *old_items = items; @@ -175,9 +174,8 @@ struct hb_hashmap_t if (unlikely (hb_object_is_immutable (this))) return; if (items) - + hb_iter (items, mask + 1) - | hb_apply (&item_t::clear) - ; + for (auto &_ : hb_iter (items, mask + 1)) + _.clear (); population = occupancy = 0; } diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 413774284..d06c0fa4a 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -101,25 +101,23 @@ struct hmtxvmtx unsigned num_advances) { unsigned idx = 0; - + it - | hb_apply ([c, &idx, num_advances] (const hb_item_type& _) - { - if (idx < num_advances) - { - LongMetric lm; - lm.advance = _.first; - lm.sb = _.second; - if (unlikely (!c->embed (&lm))) return; - } - else - { - FWORD *sb = c->allocate_size (FWORD::static_size); - if (unlikely (!sb)) return; - *sb = _.second; - } - idx++; - }) - ; + for (auto _ : it) + { + if (idx < num_advances) + { + LongMetric lm; + lm.advance = _.first; + lm.sb = _.second; + if (unlikely (!c->embed (&lm))) return; + } + else + { + FWORD *sb = c->allocate_size (FWORD::static_size); + if (unlikely (!sb)) return; + *sb = _.second; + } + idx++; + } } bool subset (hb_subset_context_t *c) const diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh index febe09679..ea4824394 100644 --- a/src/hb-ot-math-table.hh +++ b/src/hb-ot-math-table.hh @@ -515,10 +515,9 @@ struct MathGlyphAssembly if (parts_count) { int64_t mult = font->dir_mult (direction); - + hb_zip (partRecords.sub_array (start_offset, parts_count), hb_array (parts, *parts_count)) - | hb_apply ([&] (hb_pair_t _) - { _.first.extract (_.second, mult, font); }) - ; + for (auto _ : hb_zip (partRecords.sub_array (start_offset, parts_count), + hb_array (parts, *parts_count))) + _.first.extract (_.second, mult, font); } if (italics_correction) @@ -563,11 +562,9 @@ struct MathGlyphConstruction if (variants_count) { int64_t mult = font->dir_mult (direction); - + hb_zip (mathGlyphVariantRecord.sub_array (start_offset, variants_count), - hb_array (variants, *variants_count)) - | hb_apply ([&] (hb_pair_t _) - { _.second = {_.first.variantGlyph, font->em_mult (_.first.advanceMeasurement, mult)}; }) - ; + for (auto _ : hb_zip (mathGlyphVariantRecord.sub_array (start_offset, variants_count), + hb_array (variants, *variants_count))) + _.second = {_.first.variantGlyph, font->em_mult (_.first.advanceMeasurement, mult)}; } return mathGlyphVariantRecord.len; }