api refactoring
[m6w6/ext-psi] / src / types / impl_arg.h
1 #ifndef _PSI_TYPES_IMPL_ARG_H
2 #define _PSI_TYPES_IMPL_ARG_H
3
4 typedef struct impl_arg {
5 impl_type *type;
6 impl_var *var;
7 impl_def_val *def;
8 impl_val val;
9 zval *_zv;
10 } impl_arg;
11
12 typedef struct impl_vararg {
13 impl_arg *name;
14 struct impl_args *args;
15 token_t *types;
16 impl_val *values;
17 void **free_list;
18 } impl_vararg;
19
20 static inline impl_arg *init_impl_arg(impl_type *type, impl_var *var, impl_def_val *def) {
21 impl_arg *arg = calloc(1, sizeof(*arg));
22 arg->type = type;
23 arg->var = var;
24 arg->var->arg = arg;
25 arg->def = def;
26 return arg;
27 }
28
29 static inline void free_impl_arg(impl_arg *arg) {
30 free_impl_type(arg->type);
31 free_impl_var(arg->var);
32 if (arg->def) {
33 free_impl_def_val(arg->def);
34 }
35 free(arg);
36 }
37
38 #endif