Merge type and parsetype into a single struct.

It doesn't make sense to re-create the same structure, or even
re-allocated any of the memory.
This commit is contained in:
2018-04-17 15:49:09 -07:00
parent ade89ebf79
commit 264f420186
8 changed files with 35 additions and 75 deletions

View File

@@ -1,4 +1,5 @@
#include "value.h"
#include "parsetype.h"
void libab_value_init(libab_value* value, void* data, libab_ref* type) {
value->data = data;
@@ -7,9 +8,9 @@ void libab_value_init(libab_value* value, void* data, libab_ref* type) {
void libab_value_free(libab_value* value) {
void (*free_function)(void*);
libab_type* value_type;
libab_parsetype* value_type;
libab_ref_free(&value->type);
value_type = libab_ref_get(&value->type);
free_function = value_type->base->free_function;
free_function = value_type->data_u.base->free_function;
if(free_function) free_function(value->data);
}