api refactoring
[m6w6/ext-psi] / src / types / let_calloc.h
1 #ifndef _PSI_TYPES_LET_CALLOC_H
2 #define _PSI_TYPES_LET_CALLOC_H
3
4 typedef struct let_calloc {
5 num_exp *nmemb;
6 num_exp *size;
7 } let_calloc;
8
9 static inline let_calloc *init_let_calloc(num_exp *nmemb, num_exp *size) {
10 let_calloc *alloc = calloc(1, sizeof(*alloc));
11 alloc->nmemb = nmemb;
12 alloc->size = size;
13 return alloc;
14 }
15
16 static inline void free_let_calloc(let_calloc *alloc) {
17 free_num_exp(alloc->nmemb);
18 free_num_exp(alloc->size);
19 free(alloc);
20 }
21
22 #endif