Add the libab prefix to free functions.
This commit is contained in:
@@ -6,26 +6,26 @@
|
||||
#include "value.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void free_function(void* func) {
|
||||
void libab_free_function(void* func) {
|
||||
libab_function_free(func);
|
||||
free(func);
|
||||
}
|
||||
void free_function_list(void* function_list) {
|
||||
void libab_free_function_list(void* function_list) {
|
||||
libab_function_list_free(function_list);
|
||||
free(function_list);
|
||||
}
|
||||
void free_unit(void* unit) {
|
||||
void libab_free_unit(void* unit) {
|
||||
|
||||
}
|
||||
void free_parsetype(void* parsetype) {
|
||||
void libab_free_parsetype(void* parsetype) {
|
||||
libab_parsetype_free(parsetype);
|
||||
free(parsetype);
|
||||
}
|
||||
void free_table(void* table) {
|
||||
void libab_free_table(void* table) {
|
||||
libab_table_free(table);
|
||||
free(table);
|
||||
}
|
||||
void free_value(void* value) {
|
||||
void libab_free_value(void* value) {
|
||||
libab_value_free(value);
|
||||
free(value);
|
||||
}
|
||||
|
||||
@@ -224,9 +224,9 @@ libab_result _interpreter_copy_resolved_type(libab_ref* type,
|
||||
}
|
||||
|
||||
if (result == LIBAB_SUCCESS) {
|
||||
result = libab_ref_new(into, copy, free_parsetype);
|
||||
result = libab_ref_new(into, copy, libab_free_parsetype);
|
||||
if (result != LIBAB_SUCCESS) {
|
||||
free_parsetype(copy);
|
||||
libab_free_parsetype(copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1059,7 +1059,7 @@ libab_result _interpreter_wrap_function_type(
|
||||
libab_result result = _interpreter_create_function_type(state, tree, scope, &type);
|
||||
|
||||
if(result == LIBAB_SUCCESS) {
|
||||
result = libab_ref_new(into, type, free_parsetype);
|
||||
result = libab_ref_new(into, type, libab_free_parsetype);
|
||||
}
|
||||
|
||||
if(result != LIBAB_SUCCESS) {
|
||||
@@ -1076,7 +1076,7 @@ libab_result _interpreter_create_function_value(
|
||||
|
||||
libab_ref_null(&type);
|
||||
libab_ref_null(into);
|
||||
result = libab_create_function_tree(&function, free_function, tree, scope);
|
||||
result = libab_create_function_tree(&function, libab_free_function, tree, scope);
|
||||
|
||||
if(result == LIBAB_SUCCESS) {
|
||||
libab_ref_free(&type);
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include <stdlib.h>
|
||||
#include "free_functions.h"
|
||||
|
||||
static libab_basetype _basetype_function_list = {free_function_list, NULL, 0};
|
||||
static libab_basetype _basetype_function_list = {libab_free_function_list, NULL, 0};
|
||||
|
||||
static libab_basetype_param _basetype_function_params[] = {{BT_LIST, NULL}};
|
||||
|
||||
static libab_basetype _basetype_function = {free_function,
|
||||
static libab_basetype _basetype_function = {libab_free_function,
|
||||
_basetype_function_params, 1};
|
||||
|
||||
static libab_basetype _basetype_unit = { free_unit, NULL, 0 };
|
||||
static libab_basetype _basetype_unit = { libab_free_unit, NULL, 0 };
|
||||
|
||||
libab_result _prepare_types(libab* ab, void (*free_function)(void*));
|
||||
|
||||
@@ -154,7 +154,7 @@ libab_result _create_value_function_internal(libab_ref* into, libab_ref* type,
|
||||
libab_ref* scope) {
|
||||
libab_ref function_ref;
|
||||
libab_result result =
|
||||
libab_create_function_internal(&function_ref, free_function, func, scope);
|
||||
libab_create_function_internal(&function_ref, libab_free_function, func, scope);
|
||||
libab_ref_null(into);
|
||||
if (result == LIBAB_SUCCESS) {
|
||||
libab_ref_free(into);
|
||||
|
||||
14
src/util.c
14
src/util.c
@@ -135,7 +135,7 @@ libab_result libab_resolve_parsetype_copy(libab_parsetype* to_resolve,
|
||||
}
|
||||
|
||||
if(result == LIBAB_SUCCESS) {
|
||||
result = libab_ref_new(into, parsetype, free_parsetype);
|
||||
result = libab_ref_new(into, parsetype, libab_free_parsetype);
|
||||
if(result != LIBAB_SUCCESS) libab_parsetype_free(parsetype);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ libab_result libab_instantiate_basetype(libab_basetype* to_instantiate,
|
||||
}
|
||||
|
||||
if (result == LIBAB_SUCCESS) {
|
||||
result = libab_ref_new(into, parsetype, free_parsetype);
|
||||
result = libab_ref_new(into, parsetype, libab_free_parsetype);
|
||||
if (result != LIBAB_SUCCESS) {
|
||||
libab_parsetype_free(parsetype);
|
||||
}
|
||||
@@ -184,10 +184,10 @@ libab_result libab_create_table(libab_ref* into, libab_ref* parent) {
|
||||
if ((table = malloc(sizeof(*table)))) {
|
||||
libab_table_init(table);
|
||||
libab_table_set_parent(table, parent);
|
||||
result = libab_ref_new(into, table, free_table);
|
||||
result = libab_ref_new(into, table, libab_free_table);
|
||||
|
||||
if (result != LIBAB_SUCCESS) {
|
||||
free_table(table);
|
||||
libab_free_table(table);
|
||||
}
|
||||
} else {
|
||||
result = LIBAB_MALLOC;
|
||||
@@ -205,10 +205,10 @@ libab_result libab_create_value_ref(libab_ref* into, libab_ref* data,
|
||||
libab_result result = LIBAB_SUCCESS;
|
||||
if ((value = malloc(sizeof(*value)))) {
|
||||
libab_value_init_ref(value, data, type);
|
||||
result = libab_ref_new(into, value, free_value);
|
||||
result = libab_ref_new(into, value, libab_free_value);
|
||||
|
||||
if (result != LIBAB_SUCCESS) {
|
||||
free_value(value);
|
||||
libab_free_value(value);
|
||||
}
|
||||
} else {
|
||||
result = LIBAB_MALLOC;
|
||||
@@ -232,7 +232,7 @@ libab_result libab_create_value_raw(libab_ref* into, void* data,
|
||||
}
|
||||
|
||||
if (result == LIBAB_SUCCESS) {
|
||||
result = libab_ref_new(into, value, free_value);
|
||||
result = libab_ref_new(into, value, libab_free_value);
|
||||
if (result != LIBAB_SUCCESS) {
|
||||
libab_value_free(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user