Skip to content

Commit

Permalink
fix(scanner): use ts_* allocator functions
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Mar 26, 2024
1 parent b974719 commit 6909efa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "tag.h"
#include "tree_sitter/parser.h"

#include <stdio.h>
#include <wctype.h>
Expand Down Expand Up @@ -413,7 +414,7 @@ static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
}

void *tree_sitter_svelte_external_scanner_create() {
Scanner *scanner = (Scanner *)calloc(1, sizeof(Scanner));
Scanner *scanner = (Scanner *)ts_calloc(1, sizeof(Scanner));
return scanner;
}

Expand All @@ -438,5 +439,5 @@ void tree_sitter_svelte_external_scanner_destroy(void *payload) {
tag_free(array_get(&scanner->tags, i));
}
array_delete(&scanner->tags);
free(scanner);
ts_free(scanner);
}
2 changes: 0 additions & 2 deletions src/tag.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "tree_sitter/array.h"
#include "tree_sitter/parser.h"

#include <assert.h>
#include <string.h>

typedef enum {
Expand Down

0 comments on commit 6909efa

Please sign in to comment.