Build with all warnings enabled

Fix resulting warnings
This commit is contained in:
Max Brunsfeld 2014-03-04 18:28:28 -08:00
parent 6253c19524
commit af64d3fffa
4 changed files with 18 additions and 8 deletions

View file

@ -21,7 +21,7 @@ ts_tree * ts_tree_make_leaf(ts_symbol symbol, size_t size, size_t offset) {
}
ts_tree * ts_tree_make_node(ts_symbol symbol, size_t child_count, ts_tree **children, size_t size, size_t offset) {
for (int i = 0; i < child_count; i++)
for (size_t i = 0; i < child_count; i++)
ts_tree_retain(children[i]);
ts_tree *result = ts_tree_make(symbol, size, offset);
result->data.children = { .count = child_count, .contents = children };
@ -47,7 +47,7 @@ void ts_tree_release(ts_tree *tree) {
if (tree->ref_count == 0) {
ts_tree **children = ts_tree_children(tree);
if (children) {
for (int i = 0; i < ts_tree_child_count(tree); i++)
for (size_t i = 0; i < ts_tree_child_count(tree); i++)
ts_tree_release(children[i]);
free(children);
}
@ -62,7 +62,7 @@ int ts_tree_equals(const ts_tree *node1, const ts_tree *node2) {
} else {
if (node1->data.children.count != node2->data.children.count)
return 0;
for (int i = 0; i < node1->data.children.count; i++) {
for (size_t i = 0; i < node1->data.children.count; i++) {
ts_tree *child1 = node1->data.children.contents[i];
ts_tree *child2 = node2->data.children.contents[i];
if (!ts_tree_equals(child1, child2))
@ -86,7 +86,7 @@ static string __tree_to_string(const ts_tree *tree, const char **symbol_names) {
if (!tree) return "#<null-tree>";
if (tree->symbol == ts_builtin_sym_error) return "(ERROR)";
string result = string("(") + symbol_names[tree->symbol];
for (int i = 0; i < tree->data.children.count; i++)
for (size_t i = 0; i < tree->data.children.count; i++)
result += " " + __tree_to_string(tree->data.children.contents[i], symbol_names);
return result + ")";
}
@ -100,7 +100,7 @@ char * ts_tree_string(const ts_tree *tree, const char **symbol_names) {
char * ts_tree_error_string(const ts_tree *tree, const char **symbol_names) {
string result = string("Unexpected character '") + tree->data.error.lookahead_char + "'. Expected:";
for (int i = 0; i < tree->data.error.expected_input_count; i++) {
for (size_t i = 0; i < tree->data.error.expected_input_count; i++) {
ts_symbol symbol = tree->data.error.expected_inputs[i];
result += string(" ") + symbol_names[symbol];
}