Skip to content

Commit d2592b0

Browse files
authored
fix: use tag_free to clear vector strings (#62)
1 parent ab91d87 commit d2592b0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/scanner.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ typedef struct {
4646

4747
#define VEC_POP(vec) \
4848
{ \
49-
STRING_FREE(VEC_BACK(vec).custom_tag_name); \
49+
if (VEC_BACK(vec).type == CUSTOM) { \
50+
tag_free(&VEC_BACK(vec)); \
51+
} \
5052
(vec).len--; \
5153
}
5254

@@ -62,9 +64,7 @@ typedef struct {
6264
#define VEC_CLEAR(vec) \
6365
{ \
6466
for (int i = 0; i < (vec).len; i++) { \
65-
if ((vec).data[i].type == CUSTOM) { \
66-
STRING_FREE((vec).data[i].custom_tag_name); \
67-
} \
67+
tag_free(&(vec).data[i]); \
6868
} \
6969
(vec).len = 0; \
7070
}
@@ -320,8 +320,6 @@ bool scan_start_tag_name(Scanner *scanner, TSLexer *lexer) {
320320
return false;
321321
}
322322
Tag tag = for_name(tag_name.data);
323-
if (tag.type == CUSTOM) {
324-
}
325323
VEC_PUSH(scanner->tags, tag);
326324
switch (tag.type) {
327325
case SCRIPT:

0 commit comments

Comments
 (0)