api refactoring
[m6w6/ext-psi] / src / types / decl.h
1 #ifndef _PSI_TYPES_DECL_H
2 #define _PSI_TYPES_DECL_H
3
4 typedef struct decl {
5 decl_abi *abi;
6 decl_arg *func;
7 decl_args *args;
8 struct impl *impl;
9 decl_callinfo call;
10 } decl;
11
12 static inline decl* init_decl(decl_abi *abi, decl_arg *func, decl_args *args) {
13 decl *d = calloc(1, sizeof(*d));
14 d->abi = abi;
15 d->func = func;
16 d->args = args;
17 return d;
18 }
19
20 static inline void free_decl(decl *d) {
21 free_decl_abi(d->abi);
22 free_decl_arg(d->func);
23 if (d->args) {
24 free_decl_args(d->args);
25 }
26 free(d);
27 }
28
29 #endif