Require that eraseBetween leave at least one child or entryPresent
This commit is contained in:
@@ -1922,7 +1922,9 @@ void eraseBetween(Node **inTree, Node256 *n, int begin, int end,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Erase all nodes with a search path starting with n + [child],
|
// Erase all nodes with a search path starting with n + [child],
|
||||||
// where child in [begin, end).
|
// where child in [begin, end). To avoid the need to propagate erases up the
|
||||||
|
// search path, the caller must ensure that the result has at least one child or
|
||||||
|
// has entryPresent.
|
||||||
void eraseBetween(Node *&n, int begin, int end, WriteContext *tls) {
|
void eraseBetween(Node *&n, int begin, int end, WriteContext *tls) {
|
||||||
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
#if DEBUG_VERBOSE && !defined(NDEBUG)
|
||||||
fprintf(stderr, "eraseBetween: %s + [%d,%d)\n",
|
fprintf(stderr, "eraseBetween: %s + [%d,%d)\n",
|
||||||
@@ -1946,6 +1948,7 @@ void eraseBetween(Node *&n, int begin, int end, WriteContext *tls) {
|
|||||||
default: // GCOVR_EXCL_LINE
|
default: // GCOVR_EXCL_LINE
|
||||||
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
__builtin_unreachable(); // GCOVR_EXCL_LINE
|
||||||
}
|
}
|
||||||
|
assert(n->numChildren > 0 || n->entryPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Precondition: self is not the root. May invalidate nodes along the search
|
// Precondition: self is not the root. May invalidate nodes along the search
|
||||||
|
Reference in New Issue
Block a user