[repacker] remove clone buffer, they are unnessecary.
When nodes are duplicated it's fine to just reuse head, tail from the node being cloned since we don't modify the contents.
diff --git a/src/hb-repacker.hh b/src/hb-repacker.hh
index df4efa8..1320b42 100644
--- a/src/hb-repacker.hh
+++ b/src/hb-repacker.hh
@@ -129,33 +129,6 @@
unsigned child;
};
- struct clone_buffer_t
- {
- clone_buffer_t () : head (nullptr), tail (nullptr) {}
-
- bool copy (const hb_serialize_context_t::object_t& object)
- {
- fini ();
- unsigned size = object.tail - object.head;
- head = (char*) hb_malloc (size);
- if (!head) return false;
-
- memcpy (head, object.head, size);
- tail = head + size;
- return true;
- }
-
- char* head;
- char* tail;
-
- void fini ()
- {
- if (!head) return;
- hb_free (head);
- head = nullptr;
- }
- };
-
/*
* A topological sorting of an object graph. Ordered
* in reverse serialization order (first object in the
@@ -196,14 +169,12 @@
~graph_t ()
{
vertices_.fini_deep ();
- clone_buffers_.fini_deep ();
}
bool in_error () const
{
return !successful ||
vertices_.in_error () ||
- clone_buffers_.in_error () ||
num_roots_for_space_.in_error ();
}
@@ -541,15 +512,12 @@
auto* clone = vertices_.push ();
auto& child = vertices_[node_idx];
- clone_buffer_t* buffer = clone_buffers_.push ();
- if (vertices_.in_error ()
- || clone_buffers_.in_error ()
- || !check_success (buffer->copy (child.obj))) {
+ if (vertices_.in_error ()) {
return -1;
}
- clone->obj.head = buffer->head;
- clone->obj.tail = buffer->tail;
+ clone->obj.head = child.obj.head;
+ clone->obj.tail = child.obj.tail;
clone->distance = child.distance;
clone->space = child.space;
clone->parents.reset ();
@@ -1057,7 +1025,6 @@
// TODO(garretrieger): make private, will need to move most of offset overflow code into graph.
hb_vector_t<vertex_t> vertices_;
private:
- hb_vector_t<clone_buffer_t> clone_buffers_;
bool parents_invalid;
bool distance_invalid;
bool positions_invalid;