Increase size of ref_counts and add assertions
This bumps the size of the reference counts from 16- to 32-bit counters to make it less likely to overflow. Also assert in the retain function that the reference count didn't overflow. 32-bits seems big enough for non-pathological examples but a more fool-proof fix may be to bump it to 64-bits.
This commit is contained in:
parent
839dc53bf2
commit
5ef9c4d6aa
3 changed files with 5 additions and 3 deletions
|
|
@ -232,6 +232,7 @@ Tree *ts_tree_make_error_node(TreeArray *children) {
|
|||
void ts_tree_retain(Tree *self) {
|
||||
assert(self->ref_count > 0);
|
||||
self->ref_count++;
|
||||
assert(self->ref_count != 0);
|
||||
}
|
||||
|
||||
void ts_tree_release(Tree *self) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue