From 071a2bb4f7e433eabb21e38cd560cc4dcfacab7d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 3 Dec 2022 13:03:38 -0700 Subject: [PATCH] [serialize] Support zerocopy while sharing --- src/hb-serialize.hh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index 9aeed1414..d5573281f 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -348,8 +348,8 @@ struct hb_serialize_context_t assert (obj->head <= obj->tail); unsigned len = obj->tail - obj->head; head = zerocopy ? zerocopy : obj->head; /* Rewind head. */ - if (zerocopy) - assert (!share); + bool was_zerocopy = zerocopy; + zerocopy = nullptr; if (!len) { @@ -373,11 +373,8 @@ struct hb_serialize_context_t } tail -= len; - if (zerocopy) - { - zerocopy = nullptr; + if (was_zerocopy) assert (tail == obj->head); - } else memmove (tail, obj->head, len);