[serialize] Support zerocopy while sharing
This commit is contained in:
parent
44a5de3a97
commit
071a2bb4f7
|
@ -348,8 +348,8 @@ struct hb_serialize_context_t
|
||||||
assert (obj->head <= obj->tail);
|
assert (obj->head <= obj->tail);
|
||||||
unsigned len = obj->tail - obj->head;
|
unsigned len = obj->tail - obj->head;
|
||||||
head = zerocopy ? zerocopy : obj->head; /* Rewind head. */
|
head = zerocopy ? zerocopy : obj->head; /* Rewind head. */
|
||||||
if (zerocopy)
|
bool was_zerocopy = zerocopy;
|
||||||
assert (!share);
|
zerocopy = nullptr;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
{
|
{
|
||||||
|
@ -373,11 +373,8 @@ struct hb_serialize_context_t
|
||||||
}
|
}
|
||||||
|
|
||||||
tail -= len;
|
tail -= len;
|
||||||
if (zerocopy)
|
if (was_zerocopy)
|
||||||
{
|
|
||||||
zerocopy = nullptr;
|
|
||||||
assert (tail == obj->head);
|
assert (tail == obj->head);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
memmove (tail, obj->head, len);
|
memmove (tail, obj->head, len);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue