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

View File

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

View File

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

View File

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