From f254f45a1e6b1de6d83c97033773d20408772763 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 30 Mar 2019 19:05:51 -0700 Subject: [PATCH] [serialize] Only pack main object if there are other objects Avoids a memmove for tables that don't use the object packing mechanism. --- src/hb-serialize.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 7f32067..6179288 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -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 -- 2.7.4