Return non-const string from ts_node_string

The caller should free the string.
This commit is contained in:
Max Brunsfeld 2016-01-18 10:27:23 -08:00
parent 87316f22f3
commit 9d0835edbf
2 changed files with 2 additions and 2 deletions

View file

@ -58,7 +58,7 @@ size_t ts_node_end_byte(TSNode);
TSPoint ts_node_end_point(TSNode);
TSSymbol ts_node_symbol(TSNode);
const char *ts_node_name(TSNode, const TSDocument *);
const char *ts_node_string(TSNode, const TSDocument *);
char *ts_node_string(TSNode, const TSDocument *);
bool ts_node_eq(TSNode, TSNode);
bool ts_node_is_named(TSNode);
bool ts_node_has_changes(TSNode);

View file

@ -206,7 +206,7 @@ const char *ts_node_name(TSNode self, const TSDocument *document) {
return document->parser.language->symbol_names[ts_node__tree(self)->symbol];
}
const char *ts_node_string(TSNode self, const TSDocument *document) {
char *ts_node_string(TSNode self, const TSDocument *document) {
return ts_tree_string(ts_node__tree(self),
document->parser.language->symbol_names, false);
}