diff options
Diffstat (limited to 'src/free.c')
-rw-r--r-- | src/free.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/free.c b/src/free.c deleted file mode 100644 index ecf1d9f..0000000 --- a/src/free.c +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2023, Marvin Borner <dev@marvinborner.de> -// SPDX-License-Identifier: MIT - -#include <stdio.h> -#include <stdlib.h> - -#include <free.h> -#include <log.h> - -void free_term(struct term *term) -{ - switch (term->type) { - case ABS: - free_term(term->u.abs.term); - free(term); - break; - case APP: - free_term(term->u.app.lhs); - free_term(term->u.app.rhs); - free(term); - break; - case VAR: - free(term); - break; - case REF: - free(term); - break; - default: - fatal("invalid type %d\n", term->type); - } -} - -void free_bloc(struct bloc_parsed *bloc) -{ - for (size_t i = 0; i < bloc->length; i++) { - free_term(bloc->entries[i]); - } - - free(bloc->entries); - free(bloc); -} |