Skip to content

Commit

Permalink
scanner: use ts_ allocation functions
Browse files Browse the repository at this point in the history
  • Loading branch information
euclidianAce committed Jun 3, 2024
1 parent 897fa4b commit a936371
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scanner.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "tree_sitter/parser.h"
#include "tree_sitter/alloc.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

typedef struct {
Expand All @@ -9,8 +9,8 @@ typedef struct {
char opening_quote;
} State;

void *tree_sitter_teal_external_scanner_create() { return calloc(1, sizeof(State)); }
void tree_sitter_teal_external_scanner_destroy(void *payload) { free(payload); }
void *tree_sitter_teal_external_scanner_create() { return ts_calloc(1, sizeof(State)); }
void tree_sitter_teal_external_scanner_destroy(void *payload) { ts_free(payload); }

static inline void consume(TSLexer *lexer) { lexer->advance(lexer, false); }
static inline void skip(TSLexer *lexer) { lexer->advance(lexer, true); }
Expand Down

0 comments on commit a936371

Please sign in to comment.