Skip to content
Snippets Groups Projects
Commit c747392d authored by Jonathan Schöbel's avatar Jonathan Schöbel
Browse files

fixup! NodeFragment: added remove methods

When a child is removed, the array may be reallocated, to not waste
unused memory. If the child is removed out of the middle, all subsequent
childs have to be moved. However, if it turns out that the reallocation
is not currently possible, the method should return the NodeFragment in
a state, as if the call to the remove method never happened. This means,
that all the childs, that were moved before the realloc call, have to be
moved back and the original child has also to be written back. This was
forgotten, which is clearly a bug, which is fixed hereby.
Note that it would be theoretically possible to not move everything back
and forth, by storing the last value before the call to realloc and only
in case of success move everything. While this is possible and more
efficient, it is also a bit more complicated, and as this only takes
effect, if the OS fails to provide memory, which should be an uncommon
event, the algorithm is not changed, leaving that possible inefficient
approach.
parent 13ac85b5
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment