Make basetype take a free function.

This commit is contained in:
Danila Fedorin 2018-04-24 18:28:20 -07:00
parent 0a24fff344
commit 2f6176630f
2 changed files with 5 additions and 2 deletions

View File

@ -55,7 +55,8 @@ typedef struct libab_basetype_s libab_basetype;
* @param n the number of type parameters it has.
* @param params the parameters this basetype accepts.
*/
void libab_basetype_init(libab_basetype* basetype, int n,
void libab_basetype_init(libab_basetype* basetype,
void (*free_function)(void*), int n,
const libab_basetype_param params[]);
/**
* Frees the given basetype.

View File

@ -2,9 +2,11 @@
#include "util.h"
#include <stdlib.h>
void libab_basetype_init(libab_basetype* basetype, int n,
void libab_basetype_init(libab_basetype* basetype,
void (*free_function)(void*), int n,
const libab_basetype_param params[]) {
basetype->params = params;
basetype->count = n;
basetype->free_function = free_function;
}
void libab_basetype_free(libab_basetype* basetype) {}