X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fset_func.h;fp=src%2Ftypes%2Fset_func.h;h=54d61d38ebc640b33113813a61457c5a985c779d;hp=0000000000000000000000000000000000000000;hb=5359ad5c181e5772f350fe1cba060cbed3a05b91;hpb=04a60b34fc18ea3a2638893eaf24514177692eeb diff --git a/src/types/set_func.h b/src/types/set_func.h new file mode 100644 index 0000000..54d61d3 --- /dev/null +++ b/src/types/set_func.h @@ -0,0 +1,28 @@ +#ifndef _PSI_TYPES_SET_FUNC_H +#define _PSI_TYPES_SET_FUNC_H + +struct set_value; + +typedef struct set_func { + struct psi_token *token; + token_t type; + char *name; + void (*handler)(zval *, struct set_value *set, impl_val *ret_val); +} set_func; + +static inline set_func *init_set_func(token_t type, const char *name) { + set_func *func = calloc(1, sizeof(*func)); + func->type = type; + func->name = strdup(name); + return func; +} + +static inline void free_set_func(set_func *func) { + if (func->token) { + free(func->token); + } + free(func->name); + free(func); +} + +#endif