2015-05-25 20:21:13 -07:00
|
|
|
#include "tree_sitter/parser.h"
|
|
|
|
|
#include "runtime/tree.h"
|
2015-11-15 09:55:36 -08:00
|
|
|
#include "runtime/vector.h"
|
2015-09-18 18:04:52 -07:00
|
|
|
#include "runtime/stack.h"
|
2015-05-28 15:06:39 -07:00
|
|
|
#include "runtime/length.h"
|
2015-05-25 20:21:13 -07:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2015-11-20 00:01:53 -08:00
|
|
|
#define MAX_SUCCESSOR_COUNT 8
|
2015-06-03 09:44:13 -07:00
|
|
|
#define INITIAL_HEAD_CAPACITY 3
|
2015-06-18 15:04:03 -07:00
|
|
|
#define STARTING_TREE_CAPACITY 10
|
2015-06-03 09:44:13 -07:00
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
typedef struct StackNode {
|
|
|
|
|
StackEntry entry;
|
2015-11-20 00:01:53 -08:00
|
|
|
struct StackNode *successors[MAX_SUCCESSOR_COUNT];
|
2015-06-03 09:44:13 -07:00
|
|
|
short unsigned int successor_count;
|
|
|
|
|
short unsigned int ref_count;
|
2015-09-18 18:04:52 -07:00
|
|
|
} StackNode;
|
2015-05-25 20:21:13 -07:00
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
struct Stack {
|
|
|
|
|
StackNode **heads;
|
2015-05-25 20:21:13 -07:00
|
|
|
int head_count;
|
|
|
|
|
int head_capacity;
|
2015-11-20 00:01:53 -08:00
|
|
|
Vector pop_results;
|
|
|
|
|
Vector pop_paths;
|
2015-07-15 09:21:53 -07:00
|
|
|
TreeSelectionCallback tree_selection_callback;
|
2015-05-25 20:21:13 -07:00
|
|
|
};
|
|
|
|
|
|
2015-11-20 00:01:53 -08:00
|
|
|
typedef struct {
|
|
|
|
|
size_t goal_tree_count;
|
|
|
|
|
StackNode *node;
|
|
|
|
|
Vector trees;
|
|
|
|
|
bool is_shared;
|
|
|
|
|
} PopPath;
|
|
|
|
|
|
2015-05-25 20:21:13 -07:00
|
|
|
/*
|
2015-06-03 09:44:13 -07:00
|
|
|
* Section: Stack lifecycle
|
2015-05-25 20:21:13 -07:00
|
|
|
*/
|
|
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
Stack *ts_stack_new(TreeSelectionCallback tree_selection_callback) {
|
2015-10-14 21:52:13 -07:00
|
|
|
Stack *self = malloc(sizeof(Stack));
|
|
|
|
|
*self = (Stack){
|
2015-09-18 18:04:52 -07:00
|
|
|
.heads = calloc(INITIAL_HEAD_CAPACITY, sizeof(StackNode *)),
|
2015-05-25 20:21:13 -07:00
|
|
|
.head_count = 1,
|
|
|
|
|
.head_capacity = INITIAL_HEAD_CAPACITY,
|
2015-07-15 09:21:53 -07:00
|
|
|
.tree_selection_callback = tree_selection_callback,
|
2015-11-20 00:01:53 -08:00
|
|
|
.pop_results = vector_new(sizeof(StackPopResult), 4),
|
|
|
|
|
.pop_paths = vector_new(sizeof(PopPath), 4),
|
2015-05-25 20:21:13 -07:00
|
|
|
};
|
2015-10-14 21:52:13 -07:00
|
|
|
return self;
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
void ts_stack_delete(Stack *self) {
|
2015-11-20 00:01:53 -08:00
|
|
|
vector_delete(&self->pop_results);
|
|
|
|
|
vector_delete(&self->pop_paths);
|
2015-10-14 21:52:13 -07:00
|
|
|
free(self->heads);
|
|
|
|
|
free(self);
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2015-06-03 09:44:13 -07:00
|
|
|
* Section: Reading from the stack
|
2015-05-25 20:21:13 -07:00
|
|
|
*/
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
TSStateId ts_stack_top_state(const Stack *self, int head) {
|
|
|
|
|
StackEntry *entry = ts_stack_head((Stack *)self, head);
|
2015-06-18 15:04:03 -07:00
|
|
|
return entry ? entry->state : 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-02 07:53:15 -08:00
|
|
|
TSLength ts_stack_top_position(const Stack *self, int head) {
|
|
|
|
|
StackEntry *entry = ts_stack_head((Stack *)self, head);
|
|
|
|
|
return entry ? entry->position : ts_length_zero();
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
TSTree *ts_stack_top_tree(const Stack *self, int head) {
|
|
|
|
|
StackEntry *entry = ts_stack_head((Stack *)self, head);
|
2015-06-18 15:04:03 -07:00
|
|
|
return entry ? entry->tree : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
StackEntry *ts_stack_head(Stack *self, int head) {
|
|
|
|
|
assert(head < self->head_count);
|
|
|
|
|
StackNode *node = self->heads[head];
|
2015-06-03 09:44:13 -07:00
|
|
|
return node ? &node->entry : NULL;
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
int ts_stack_head_count(const Stack *self) {
|
|
|
|
|
return self->head_count;
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
int ts_stack_entry_next_count(const StackEntry *entry) {
|
|
|
|
|
return ((const StackNode *)entry)->successor_count;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
StackEntry *ts_stack_entry_next(const StackEntry *entry, int i) {
|
|
|
|
|
return &((const StackNode *)entry)->successors[i]->entry;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Section: Manipulating nodes (Private)
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
static void stack_node_retain(StackNode *self) {
|
|
|
|
|
if (!self)
|
2015-07-27 18:29:48 -07:00
|
|
|
return;
|
2015-10-14 21:52:13 -07:00
|
|
|
assert(self->ref_count != 0);
|
|
|
|
|
self->ref_count++;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
static bool stack_node_release(StackNode *self) {
|
|
|
|
|
if (!self)
|
2015-07-27 18:29:48 -07:00
|
|
|
return false;
|
2015-10-14 21:52:13 -07:00
|
|
|
assert(self->ref_count != 0);
|
|
|
|
|
self->ref_count--;
|
|
|
|
|
if (self->ref_count == 0) {
|
|
|
|
|
for (int i = 0; i < self->successor_count; i++)
|
|
|
|
|
stack_node_release(self->successors[i]);
|
|
|
|
|
ts_tree_release(self->entry.tree);
|
|
|
|
|
free(self);
|
2015-06-03 09:44:13 -07:00
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
static StackNode *stack_node_new(StackNode *next, TSStateId state, TSTree *tree) {
|
2015-10-14 21:52:13 -07:00
|
|
|
StackNode *self = malloc(sizeof(StackNode));
|
2015-10-28 12:10:45 -07:00
|
|
|
assert(tree->ref_count > 0);
|
2015-06-03 09:44:13 -07:00
|
|
|
ts_tree_retain(tree);
|
|
|
|
|
stack_node_retain(next);
|
2015-12-02 07:53:15 -08:00
|
|
|
TSLength position = ts_tree_total_size(tree);
|
2015-12-04 20:20:29 -08:00
|
|
|
if (next)
|
2015-12-02 07:53:15 -08:00
|
|
|
position = ts_length_add(next->entry.position, position);
|
2015-10-14 21:52:13 -07:00
|
|
|
*self = (StackNode){
|
2015-06-03 09:44:13 -07:00
|
|
|
.ref_count = 1,
|
|
|
|
|
.successor_count = 1,
|
2015-07-27 18:29:48 -07:00
|
|
|
.successors = { next, NULL, NULL },
|
2015-12-04 20:56:33 -08:00
|
|
|
.entry = {.state = state, .tree = tree, .position = position },
|
2015-06-03 09:44:13 -07:00
|
|
|
};
|
2015-10-14 21:52:13 -07:00
|
|
|
return self;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
static void ts_stack__add_node_successor(Stack *self, StackNode *node,
|
2015-09-18 18:04:52 -07:00
|
|
|
StackNode *new_successor) {
|
2015-07-15 09:21:53 -07:00
|
|
|
for (int i = 0; i < node->successor_count; i++) {
|
2015-09-18 18:04:52 -07:00
|
|
|
StackNode *successor = node->successors[i];
|
2015-11-11 17:31:40 -08:00
|
|
|
if (!successor)
|
|
|
|
|
continue;
|
2015-07-15 09:21:53 -07:00
|
|
|
if (successor == new_successor)
|
2015-06-03 09:44:13 -07:00
|
|
|
return;
|
2015-11-11 17:31:40 -08:00
|
|
|
|
2015-07-15 09:21:53 -07:00
|
|
|
if (successor->entry.state == new_successor->entry.state) {
|
2015-10-28 12:10:45 -07:00
|
|
|
if (successor->entry.tree != new_successor->entry.tree) {
|
2015-10-14 21:52:13 -07:00
|
|
|
successor->entry.tree = self->tree_selection_callback.callback(
|
|
|
|
|
self->tree_selection_callback.data, successor->entry.tree,
|
2015-07-27 18:29:48 -07:00
|
|
|
new_successor->entry.tree);
|
2015-10-28 12:10:45 -07:00
|
|
|
ts_tree_retain(successor->entry.tree);
|
|
|
|
|
}
|
2015-07-15 09:21:53 -07:00
|
|
|
for (int j = 0; j < new_successor->successor_count; j++)
|
2015-10-14 21:52:13 -07:00
|
|
|
ts_stack__add_node_successor(self, successor,
|
2015-09-18 18:04:52 -07:00
|
|
|
new_successor->successors[j]);
|
2015-07-15 09:21:53 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stack_node_retain(new_successor);
|
|
|
|
|
node->successors[node->successor_count] = new_successor;
|
|
|
|
|
node->successor_count++;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-05-25 20:21:13 -07:00
|
|
|
/*
|
2015-06-03 09:44:13 -07:00
|
|
|
* Section: Mutating the stack (Private)
|
2015-05-25 20:21:13 -07:00
|
|
|
*/
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
static int ts_stack__add_head(Stack *self, StackNode *node) {
|
|
|
|
|
if (self->head_count == self->head_capacity) {
|
|
|
|
|
self->head_capacity += 3;
|
|
|
|
|
self->heads =
|
|
|
|
|
realloc(self->heads, self->head_capacity * sizeof(StackNode *));
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
2015-10-14 21:52:13 -07:00
|
|
|
int new_index = self->head_count++;
|
|
|
|
|
self->heads[new_index] = node;
|
2015-06-03 09:44:13 -07:00
|
|
|
stack_node_retain(node);
|
|
|
|
|
return new_index;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-20 00:01:53 -08:00
|
|
|
static int ts_stack__find_head(Stack *self, StackNode *node) {
|
2015-10-14 21:52:13 -07:00
|
|
|
for (int i = 0; i < self->head_count; i++)
|
|
|
|
|
if (self->heads[i] == node) {
|
2015-07-08 17:34:21 -07:00
|
|
|
return i;
|
|
|
|
|
}
|
2015-11-20 00:01:53 -08:00
|
|
|
return -1;
|
2015-07-08 17:34:21 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
void ts_stack_remove_head(Stack *self, int head_index) {
|
|
|
|
|
stack_node_release(self->heads[head_index]);
|
2015-10-22 11:42:38 -07:00
|
|
|
for (int i = head_index; i < self->head_count - 1; i++)
|
|
|
|
|
self->heads[i] = self->heads[i + 1];
|
2015-10-14 21:52:13 -07:00
|
|
|
self->head_count--;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
2015-05-25 20:21:13 -07:00
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
static bool ts_stack__merge_head(Stack *self, int head_index, TSStateId state,
|
2015-12-02 07:53:15 -08:00
|
|
|
TSTree *tree, TSLength position) {
|
2015-07-27 18:29:48 -07:00
|
|
|
for (int i = 0; i < head_index; i++) {
|
2015-10-14 21:52:13 -07:00
|
|
|
StackNode *head = self->heads[i];
|
2015-12-04 20:56:33 -08:00
|
|
|
if (head->entry.state == state &&
|
|
|
|
|
ts_length_eq(head->entry.position, position)) {
|
2015-07-15 09:21:53 -07:00
|
|
|
if (head->entry.tree != tree) {
|
2015-10-14 21:52:13 -07:00
|
|
|
head->entry.tree = self->tree_selection_callback.callback(
|
|
|
|
|
self->tree_selection_callback.data, head->entry.tree, tree);
|
2015-10-28 12:10:45 -07:00
|
|
|
ts_tree_retain(head->entry.tree);
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
2015-10-14 21:52:13 -07:00
|
|
|
ts_stack__add_node_successor(self, head, self->heads[head_index]);
|
|
|
|
|
ts_stack_remove_head(self, head_index);
|
2015-07-15 09:21:53 -07:00
|
|
|
return true;
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Section: Mutating the stack (Public)
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
bool ts_stack_push(Stack *self, int head_index, TSStateId state, TSTree *tree) {
|
|
|
|
|
assert(head_index < self->head_count);
|
2015-12-02 07:53:15 -08:00
|
|
|
TSLength position = ts_tree_total_size(tree);
|
|
|
|
|
if (self->heads[head_index])
|
|
|
|
|
position = ts_length_add(self->heads[head_index]->entry.position, position);
|
|
|
|
|
if (ts_stack__merge_head(self, head_index, state, tree, position))
|
2015-05-25 20:27:51 -07:00
|
|
|
return true;
|
2015-10-14 21:52:13 -07:00
|
|
|
self->heads[head_index] = stack_node_new(self->heads[head_index], state, tree);
|
2015-05-25 20:21:13 -07:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
void ts_stack_add_alternative(Stack *self, int head_index, TSTree *tree) {
|
|
|
|
|
assert(head_index < self->head_count);
|
|
|
|
|
StackEntry *entry = &self->heads[head_index]->entry;
|
|
|
|
|
entry->tree = self->tree_selection_callback.callback(
|
|
|
|
|
self->tree_selection_callback.data, entry->tree, tree);
|
2015-07-08 17:34:21 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
int ts_stack_split(Stack *self, int head_index) {
|
|
|
|
|
assert(head_index < self->head_count);
|
|
|
|
|
return ts_stack__add_head(self, self->heads[head_index]);
|
2015-06-03 09:44:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-11-20 11:49:04 -08:00
|
|
|
Vector ts_stack_pop(Stack *self, int head_index, int child_count,
|
|
|
|
|
bool count_extra) {
|
2015-11-20 00:01:53 -08:00
|
|
|
StackNode *previous_head = self->heads[head_index];
|
2015-06-18 15:04:03 -07:00
|
|
|
int capacity = (child_count == -1) ? STARTING_TREE_CAPACITY : child_count;
|
2015-11-20 00:01:53 -08:00
|
|
|
PopPath initial_path = {
|
|
|
|
|
.goal_tree_count = child_count,
|
|
|
|
|
.node = previous_head,
|
|
|
|
|
.trees = vector_new(sizeof(TSTree *), capacity),
|
|
|
|
|
.is_shared = false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
vector_clear(&self->pop_results);
|
|
|
|
|
vector_clear(&self->pop_paths);
|
|
|
|
|
vector_push(&self->pop_paths, &initial_path);
|
2015-05-25 20:21:13 -07:00
|
|
|
|
|
|
|
|
/*
|
2015-05-30 20:26:45 -07:00
|
|
|
* Reduce along every possible path in parallel. Stop when the given number
|
|
|
|
|
* of child trees have been collected along every path.
|
2015-05-25 20:21:13 -07:00
|
|
|
*/
|
2015-05-30 20:26:45 -07:00
|
|
|
bool all_paths_done = false;
|
|
|
|
|
while (!all_paths_done) {
|
|
|
|
|
all_paths_done = true;
|
2015-11-20 00:01:53 -08:00
|
|
|
|
|
|
|
|
for (size_t i = 0; i < self->pop_paths.size; i++) {
|
|
|
|
|
PopPath *path = vector_get(&self->pop_paths, i);
|
|
|
|
|
StackNode *node = path->node;
|
|
|
|
|
|
|
|
|
|
if (!node || path->trees.size == path->goal_tree_count)
|
2015-05-30 20:26:45 -07:00
|
|
|
continue;
|
2015-11-20 00:01:53 -08:00
|
|
|
|
2015-06-18 15:04:03 -07:00
|
|
|
all_paths_done = false;
|
2015-05-30 20:26:45 -07:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Children that are 'extra' do not count towards the total child count.
|
|
|
|
|
*/
|
2015-06-18 15:04:03 -07:00
|
|
|
if (ts_tree_is_extra(node->entry.tree) && !count_extra)
|
2015-11-20 00:01:53 -08:00
|
|
|
path->goal_tree_count++;
|
2015-05-30 20:26:45 -07:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If a node has more than one successor, create new paths for each of
|
|
|
|
|
* the additional successors.
|
|
|
|
|
*/
|
2015-11-20 00:01:53 -08:00
|
|
|
if (path->is_shared) {
|
|
|
|
|
path->trees = vector_copy(&path->trees);
|
|
|
|
|
path->is_shared = false;
|
2015-07-08 17:34:21 -07:00
|
|
|
}
|
2015-11-20 00:01:53 -08:00
|
|
|
|
2015-11-15 09:55:36 -08:00
|
|
|
ts_tree_retain(node->entry.tree);
|
2015-11-20 00:01:53 -08:00
|
|
|
vector_push(&path->trees, &node->entry.tree);
|
|
|
|
|
|
|
|
|
|
path->node = path->node->successors[0];
|
|
|
|
|
for (int j = 1; j < node->successor_count; j++) {
|
|
|
|
|
PopPath path_copy = *path;
|
|
|
|
|
vector_push(&self->pop_paths, &path_copy);
|
|
|
|
|
PopPath *next_path = vector_back(&self->pop_paths);
|
|
|
|
|
next_path->node = node->successors[j];
|
|
|
|
|
next_path->is_shared = true;
|
2015-05-30 20:26:45 -07:00
|
|
|
}
|
|
|
|
|
}
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
|
|
|
|
|
2015-11-20 00:01:53 -08:00
|
|
|
for (size_t i = 0; i < self->pop_paths.size; i++) {
|
|
|
|
|
PopPath *path = vector_get(&self->pop_paths, i);
|
|
|
|
|
|
|
|
|
|
if (!path->is_shared)
|
|
|
|
|
vector_reverse(&path->trees);
|
|
|
|
|
|
|
|
|
|
StackPopResult result = {
|
|
|
|
|
.trees = path->trees.contents,
|
|
|
|
|
.tree_count = path->trees.size,
|
|
|
|
|
.head_index = -1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
stack_node_retain(path->node);
|
|
|
|
|
self->heads[head_index] = path->node;
|
|
|
|
|
result.head_index = head_index;
|
2015-06-03 09:44:13 -07:00
|
|
|
} else {
|
2015-11-20 00:01:53 -08:00
|
|
|
result.head_index = ts_stack__find_head(self, path->node);
|
|
|
|
|
if (result.head_index == -1)
|
|
|
|
|
result.head_index = ts_stack__add_head(self, path->node);
|
2015-05-30 20:26:45 -07:00
|
|
|
}
|
2015-05-25 20:21:13 -07:00
|
|
|
|
2015-11-20 00:01:53 -08:00
|
|
|
vector_push(&self->pop_results, &result);
|
2015-05-30 20:26:45 -07:00
|
|
|
}
|
|
|
|
|
|
2015-06-03 09:44:13 -07:00
|
|
|
stack_node_release(previous_head);
|
2015-11-20 00:01:53 -08:00
|
|
|
return self->pop_results;
|
2015-05-25 20:21:13 -07:00
|
|
|
}
|
2015-06-18 15:04:03 -07:00
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
void ts_stack_shrink(Stack *self, int head_index, int count) {
|
|
|
|
|
StackNode *head = self->heads[head_index];
|
2015-09-18 18:04:52 -07:00
|
|
|
StackNode *new_head = head;
|
2015-06-18 15:04:03 -07:00
|
|
|
for (int i = 0; i < count; i++) {
|
2015-07-27 18:29:48 -07:00
|
|
|
if (new_head->successor_count == 0)
|
|
|
|
|
break;
|
2015-06-18 15:04:03 -07:00
|
|
|
new_head = new_head->successors[0];
|
|
|
|
|
}
|
|
|
|
|
stack_node_retain(new_head);
|
|
|
|
|
stack_node_release(head);
|
2015-10-14 21:52:13 -07:00
|
|
|
self->heads[head_index] = new_head;
|
2015-06-18 15:04:03 -07:00
|
|
|
}
|
|
|
|
|
|
2015-10-14 21:52:13 -07:00
|
|
|
void ts_stack_clear(Stack *self) {
|
|
|
|
|
for (int i = 0; i < self->head_count; i++)
|
|
|
|
|
stack_node_release(self->heads[i]);
|
|
|
|
|
self->head_count = 1;
|
|
|
|
|
self->heads[0] = NULL;
|
2015-06-18 15:04:03 -07:00
|
|
|
}
|