diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-09-26 00:46:34 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-09-26 00:46:34 -0400 |
commit | 725bd4f0b4cc067fc2770f7f8ffd9c815c745239 (patch) | |
tree | 2bf8c049473d27057ce8cbac2a08eb2be05443b6 /dimension | |
parent | 46bf25a9bed9eec6aaa8c4cad8144c7df629da30 (diff) | |
download | dimension-725bd4f0b4cc067fc2770f7f8ffd9c815c745239.tar.xz |
Add dmnsn_free() to match dmnsn_malloc().
Diffstat (limited to 'dimension')
-rw-r--r-- | dimension/common.declarations | 2 | ||||
-rw-r--r-- | dimension/common.rules | 6 | ||||
-rw-r--r-- | dimension/lexer.l | 2 | ||||
-rw-r--r-- | dimension/main.c | 4 | ||||
-rw-r--r-- | dimension/parse.c | 8 | ||||
-rw-r--r-- | dimension/tokenize.c | 14 |
6 files changed, 18 insertions, 18 deletions
diff --git a/dimension/common.declarations b/dimension/common.declarations index a181923..2e3fadb 100644 --- a/dimension/common.declarations +++ b/dimension/common.declarations @@ -29,5 +29,5 @@ %lex-param {dmnsn_symbol_table *symtable} %lex-param {void *yyscanner} -%destructor { free($$); } <value> +%destructor { dmnsn_free($$); } <value> %destructor { dmnsn_delete_astnode($$); } <astnode> diff --git a/dimension/common.rules b/dimension/common.rules index e5e6543..d91cac3 100644 --- a/dimension/common.rules +++ b/dimension/common.rules @@ -30,7 +30,7 @@ IDENTIFIER: "identifier" { } $$ = dmnsn_new_astnode(DMNSN_AST_IDENTIFIER, @$); $$.ptr = dmnsn_strdup(id); - free($1); + dmnsn_free($1); } ; @@ -604,13 +604,13 @@ FLOAT_LITERAL: "integer" { $$ = dmnsn_new_astnode(DMNSN_AST_INTEGER, @$); $$.ptr = dmnsn_malloc(sizeof(long)); *(long *)$$.ptr = strtol($1, NULL, 0); - free($1); + dmnsn_free($1); } | "float" { $$ = dmnsn_new_astnode(DMNSN_AST_FLOAT, @$); $$.ptr = dmnsn_malloc(sizeof(double)); *(double *)$$.ptr = strtod($1, NULL); - free($1); + dmnsn_free($1); } ; diff --git a/dimension/lexer.l b/dimension/lexer.l index 190acb0..dd25363 100644 --- a/dimension/lexer.l +++ b/dimension/lexer.l @@ -420,7 +420,7 @@ dmnsn_tokenize(FILE *file, const char *filename) static void dmnsn_delete_token(dmnsn_token token) { - free(token.value); + dmnsn_free(token.value); } void diff --git a/dimension/main.c b/dimension/main.c index 951f126..bb44df5 100644 --- a/dimension/main.c +++ b/dimension/main.c @@ -275,7 +275,7 @@ main(int argc, char **argv) strcpy(output, base); ext = output + len; } - free(input_copy); + dmnsn_free(input_copy); strcpy(ext, ".png"); free_output = true; } @@ -283,7 +283,7 @@ main(int argc, char **argv) /* Open the output file */ FILE *output_file = fopen(output, "wb"); if (free_output) - free(output); + dmnsn_free(output); if (!output_file) { fprintf(stderr, "Couldn't open output file!"); return EXIT_FAILURE; diff --git a/dimension/parse.c b/dimension/parse.c index 93edb84..4e748cc 100644 --- a/dimension/parse.c +++ b/dimension/parse.c @@ -39,7 +39,7 @@ static void dmnsn_delete_patricia_trie(dmnsn_patricia_trie *trie) { if (trie) { - free(trie->prefix); + dmnsn_free(trie->prefix); if (trie->leaf) dmnsn_delete_astnode(trie->value); @@ -51,7 +51,7 @@ dmnsn_delete_patricia_trie(dmnsn_patricia_trie *trie) } dmnsn_delete_array(trie->children); - free(trie); + dmnsn_free(trie); } } @@ -455,9 +455,9 @@ dmnsn_delete_astnode(dmnsn_astnode astnode) if (astnode.free_fn) { (*astnode.free_fn)(astnode.ptr); } else { - free(astnode.ptr); + dmnsn_free(astnode.ptr); } - free(astnode.refcount); + dmnsn_free(astnode.refcount); } else { --*astnode.refcount; } diff --git a/dimension/tokenize.c b/dimension/tokenize.c index 7315a60..78c0de8 100644 --- a/dimension/tokenize.c +++ b/dimension/tokenize.c @@ -71,11 +71,11 @@ dmnsn_delete_token_buffer(void *ptr) dmnsn_token_buffer *tbuffer = ptr; if (tbuffer) { DMNSN_ARRAY_FOREACH (dmnsn_buffered_token *, buffered, tbuffer->buffered) { - free(buffered->lval.value); + dmnsn_free(buffered->lval.value); } dmnsn_delete_array(tbuffer->buffered); - free(tbuffer); + dmnsn_free(tbuffer); } } @@ -238,13 +238,13 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, strcpy(local_include, localdir); strcat(local_include, "/"); strcat(local_include, include); - free(filename_copy); + dmnsn_free(filename_copy); FILE *file = fopen(local_include, "r"); if (!file) { dmnsn_diagnostic(*llocp, "Couldn't open include file '%s'", include); dmnsn_undef_symbol(symtable, "$include"); - free(local_include); + dmnsn_free(local_include); dmnsn_delete_token_buffer(tbuffer); return NULL; } @@ -256,7 +256,7 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, include); dmnsn_undef_symbol(symtable, "$include"); fclose(file); - free(local_include); + dmnsn_free(local_include); dmnsn_delete_token_buffer(tbuffer); return NULL; } @@ -273,7 +273,7 @@ dmnsn_include_buffer(int token, dmnsn_token_buffer *prev, "$includes has wrong type."); dmnsn_astnode fnode = dmnsn_new_ast_string(local_include); - free(local_include); + dmnsn_free(local_include); tbuffer->filename = fnode.ptr; dmnsn_array_push(includes->children, &fnode); @@ -502,7 +502,7 @@ dmnsn_if_buffer(int token, dmnsn_token_buffer *prev, if (cond) { dmnsn_array_push(tbuffer->buffered, &buffered); } else { - free(buffered.lval.value); + dmnsn_free(buffered.lval.value); } } |