Turn more of simple dagger chains to foreach

Less noise, as was agreed before and applied 385741d also
This commit is contained in:
Ebrahim Byagowi 2020-03-13 08:33:34 +03:30 committed by GitHub
parent 755a77d660
commit a224f4179f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 90 deletions

View File

@ -184,7 +184,8 @@ struct CFFIndex
else
{
serialize_header(c, + it | hb_map ([] (const byte_str_t &_) { return _.length; }));
+ it | hb_apply ([&] (const byte_str_t &_) { _.copy (c); });
for (const byte_str_t &_ : +it)
_.copy (c);
}
return_trace (true);
}
@ -223,13 +224,11 @@ struct CFFIndex
/* serialize indices */
unsigned int offset = 1;
unsigned int i = 0;
+ it
| hb_apply ([&] (unsigned _)
for (unsigned _ : +it)
{
CFFIndex<COUNT>::set_offset_at (i++, offset);
offset += _;
})
;
}
CFFIndex<COUNT>::set_offset_at (i, offset);
return_trace (true);

View File

@ -83,8 +83,7 @@ struct CmapSubtableFormat4
HBUINT16 *endCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_endcp = 0xFFFF;
+ it
| hb_apply ([&] (const hb_item_type<Iterator> _)
for (const hb_item_type<Iterator> _ : +it)
{
if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first)
{
@ -93,8 +92,7 @@ struct CmapSubtableFormat4
c->copy<HBUINT16> (end_code);
}
prev_endcp = _.first;
})
;
}
{
// last endCode
@ -121,8 +119,7 @@ struct CmapSubtableFormat4
HBUINT16 *startCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_cp = 0xFFFF;
+ it
| hb_apply ([&] (const hb_item_type<Iterator> _)
for (const hb_item_type<Iterator> _ : +it)
{
if (prev_cp == 0xFFFF || prev_cp + 1u != _.first)
{
@ -132,8 +129,7 @@ struct CmapSubtableFormat4
}
prev_cp = _.first;
})
;
}
// There must be a final entry with end_code == 0xFFFF.
if (it.len () == 0 || prev_cp != 0xFFFF)
@ -162,8 +158,7 @@ struct CmapSubtableFormat4
if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size)
return nullptr;
+ it
| hb_apply ([&] (const hb_item_type<Iterator> _)
for (const hb_item_type<Iterator> _ : +it)
{
if (_.first == startCode[i])
{
@ -184,8 +179,7 @@ struct CmapSubtableFormat4
last_gid = _.second;
last_cp = _.first;
})
;
}
if (it.len () == 0 || last_cp != 0xFFFF)
{
@ -599,8 +593,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
hb_codepoint_t startCharCode = 0xFFFF, endCharCode = 0xFFFF;
hb_codepoint_t glyphID = 0;
+ it
| hb_apply ([&] (const hb_item_type<Iterator> _)
for (const hb_item_type<Iterator> _ : +it)
{
if (startCharCode == 0xFFFF)
{
@ -621,11 +614,8 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
glyphID = _.second;
}
else
{
endCharCode = _.first;
}
})
;
CmapSubtableLongGroup record;
record.startCharCode = startCharCode;

View File

@ -107,11 +107,8 @@ struct hdmx
this->numRecords = it.len ();
this->sizeDeviceRecord = DeviceRecord::get_size (it ? (*it).second.len () : 0);
+ it
| hb_apply ([c] (const hb_item_type<Iterator>& _) {
for (const hb_item_type<Iterator>& _ : +it)
c->start_embed<DeviceRecord> ()->serialize (c, _.first, _.second);
})
;
return_trace (c->successful);
}

View File

@ -41,9 +41,7 @@ struct hb_pool_t
{
next = nullptr;
+ hb_iter (chunks)
| hb_apply ([] (chunk_t *_) { ::free (_); })
;
for (chunk_t *_ : chunks) ::free (_);
chunks.fini ();
}