Skip to content

Commit

Permalink
fix: use tag_free to clear vector strings (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Jun 30, 2023
1 parent ab91d87 commit d2592b0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ typedef struct {

#define VEC_POP(vec) \
{ \
STRING_FREE(VEC_BACK(vec).custom_tag_name); \
if (VEC_BACK(vec).type == CUSTOM) { \
tag_free(&VEC_BACK(vec)); \
} \
(vec).len--; \
}

Expand All @@ -62,9 +64,7 @@ typedef struct {
#define VEC_CLEAR(vec) \
{ \
for (int i = 0; i < (vec).len; i++) { \
if ((vec).data[i].type == CUSTOM) { \
STRING_FREE((vec).data[i].custom_tag_name); \
} \
tag_free(&(vec).data[i]); \
} \
(vec).len = 0; \
}
Expand Down Expand Up @@ -320,8 +320,6 @@ bool scan_start_tag_name(Scanner *scanner, TSLexer *lexer) {
return false;
}
Tag tag = for_name(tag_name.data);
if (tag.type == CUSTOM) {
}
VEC_PUSH(scanner->tags, tag);
switch (tag.type) {
case SCRIPT:
Expand Down

0 comments on commit d2592b0

Please sign in to comment.