From 6e42a418c8fe4231c3cc080bc771455578b0cce0 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 21 Sep 2019 16:25:54 +0430 Subject: [PATCH] Minor, turn more of hb_apply to for each --- src/hb-ot-glyf-table.hh | 5 ++-- src/hb-ot-layout-gpos-table.hh | 42 ++++++++++++---------------------- src/hb-ot-name-table.hh | 5 ++-- src/hb-ot-vorg-table.hh | 5 ++-- 4 files changed, 20 insertions(+), 37 deletions(-) diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 7446f9489..bbb8a7946 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -144,9 +144,8 @@ struct glyf { TRACE_SERIALIZE (this); - + it - | hb_apply ([=] (const SubsetGlyph& _) { _.serialize (c, plan); }) - ; + for (const SubsetGlyph& _ : it) + _.serialize (c, plan); return_trace (true); } diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 8cdfb57bd..be6cce5ff 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -512,9 +512,8 @@ struct SinglePosFormat1 auto vals = hb_second (*it); - + vals - | hb_apply ([=] (const Value& _) { c->copy (_); }) - ; + for (const Value& _ : vals) + c->copy (_); auto glyphs = + it @@ -601,15 +600,10 @@ struct SinglePosFormat2 if (unlikely (!c->check_assign (valueFormat, valFormat))) return; if (unlikely (!c->check_assign (valueCount, it.len ()))) return; - + it - | hb_map (hb_second) - | hb_apply ([=] (hb_array_t val_iter) - { - + val_iter - | hb_apply ([=] (const Value& _) { c->copy (_); }) - ; - }) - ; + for (hb_array_t val_iter : + it + | hb_map (hb_second)) + for (const Value& _ : val_iter) + c->copy (_); auto glyphs = + it @@ -675,22 +669,14 @@ struct SinglePos unsigned subset_format = 1; hb_array_t first_val_iter = hb_second (*glyph_val_iter_pairs); - + glyph_val_iter_pairs - | hb_map (hb_second) - | hb_apply ([&] (hb_array_t val_iter) - { - + hb_zip (val_iter, first_val_iter) - | hb_apply ([&] (const hb_pair_t& _) - { - if (_.first != _.second) - { - subset_format = 2; - return; - } - }) - ; - }) - ; + for (hb_array_t val_iter : + glyph_val_iter_pairs + | hb_map (hb_second)) + for (const hb_pair_t& _ : hb_zip (val_iter, first_val_iter)) + if (_.first != _.second) + { + subset_format = 2; + continue; + } return subset_format; } diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 7a7f41d82..33f5eb37b 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -191,9 +191,8 @@ struct name const void *dst_string_pool = &(this + this->stringOffset); - + it - | hb_apply ([=] (const NameRecord& _) { c->copy (_, src_string_pool, dst_string_pool); }) - ; + for (const NameRecord& _ : it) + c->copy (_, src_string_pool, dst_string_pool); if (unlikely (c->ran_out_of_room)) return_trace (false); diff --git a/src/hb-ot-vorg-table.hh b/src/hb-ot-vorg-table.hh index 1b6801a4f..2516a9010 100644 --- a/src/hb-ot-vorg-table.hh +++ b/src/hb-ot-vorg-table.hh @@ -84,9 +84,8 @@ struct VORG this->defaultVertOriginY = defaultVertOriginY; this->vertYOrigins.len = it.len (); - + it - | hb_apply ([c] (const VertOriginMetric& _) { c->copy (_); }) - ; + for (const VertOriginMetric& _ : it) + c->copy (_); } bool subset (hb_subset_context_t *c) const