[serialize] Only pack main object if there are other objects

Avoids a memmove for tables that don't use the object packing mechanism.
This commit is contained in:
Behdad Esfahbod 2019-03-30 19:05:51 -07:00
parent 946d446f9b
commit f254f45a1e
1 changed files with 5 additions and 2 deletions

View File

@ -122,8 +122,11 @@ struct hb_serialize_context_t
/* TODO Propagate errors. */
assert (current.length == 1);
/* TODO Enable when callers are updated. */
//pop_pack ();
/* Only "pack" if there exist other objects... Otherwise, don't bother.
* Saves a copy. */
if (packed.length > 1)
pop_pack ();
}
template <typename Type>