Make basetype take a free function.
This commit is contained in:
		
							parent
							
								
									0a24fff344
								
							
						
					
					
						commit
						2f6176630f
					
				@ -55,7 +55,8 @@ typedef struct libab_basetype_s libab_basetype;
 | 
				
			|||||||
 * @param n the number of type parameters it has.
 | 
					 * @param n the number of type parameters it has.
 | 
				
			||||||
 * @param params the parameters this basetype accepts.
 | 
					 * @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[]);
 | 
					                         const libab_basetype_param params[]);
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Frees the given basetype.
 | 
					 * Frees the given basetype.
 | 
				
			||||||
 | 
				
			|||||||
@ -2,9 +2,11 @@
 | 
				
			|||||||
#include "util.h"
 | 
					#include "util.h"
 | 
				
			||||||
#include <stdlib.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[]) {
 | 
					                         const libab_basetype_param params[]) {
 | 
				
			||||||
    basetype->params = params;
 | 
					    basetype->params = params;
 | 
				
			||||||
    basetype->count = n;
 | 
					    basetype->count = n;
 | 
				
			||||||
 | 
					    basetype->free_function = free_function;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void libab_basetype_free(libab_basetype* basetype) {}
 | 
					void libab_basetype_free(libab_basetype* basetype) {}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user