Compare commits

...

3 Commits

Author SHA1 Message Date
6f78d26ea1 Change the n argument of lexer_shift_buffer to size_t from int
Some checks failed
Validate the build / validate-build (push) Failing after 35s
2025-04-17 15:12:56 +02:00
1a79bf050e Remove unused ast_node_free_value
Values are all inside the ast struct and require no cleanup other than
freeing the ast struct.
2025-04-17 15:10:36 +02:00
26cb374c1d Update gitignore, add /build and remove old build artifacts 2025-04-17 15:09:29 +02:00
3 changed files with 2 additions and 10 deletions

4
.gitignore vendored
View File

@ -1,7 +1,5 @@
*.o *.o
*.d *.d
/core /core
/oas /build
/oas-asan
/oas-msan
/reports /reports

View File

@ -17,10 +17,6 @@ error_t *ast_node_alloc(ast_node_t **output) {
return nullptr; return nullptr;
} }
void ast_node_free_value(ast_node_t *node) {
// TODO: decide how value ownership will work and clean it up here
}
void ast_node_free(ast_node_t *node) { void ast_node_free(ast_node_t *node) {
if (node == nullptr) if (node == nullptr)
return; return;
@ -30,8 +26,6 @@ void ast_node_free(ast_node_t *node) {
free(node->children); free(node->children);
} }
ast_node_free_value(node);
memset(node, 0, sizeof(ast_node_t)); memset(node, 0, sizeof(ast_node_t));
free(node); free(node);
} }

View File

@ -136,7 +136,7 @@ error_t *lexer_open(lexer_t *lex, char *path) {
* *
* @pre There must be at least n characters in the input buffer * @pre There must be at least n characters in the input buffer
*/ */
void lexer_shift_buffer(lexer_t *lex, int n) { void lexer_shift_buffer(lexer_t *lex, size_t n) {
assert(lex->buffer_count >= n); assert(lex->buffer_count >= n);
lex->buffer_count -= n; lex->buffer_count -= n;
memmove(lex->buffer, lex->buffer + n, lex->buffer_count); memmove(lex->buffer, lex->buffer + n, lex->buffer_count);