X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fconst_type.h;fp=src%2Ftypes%2Fconst_type.h;h=af9efb79bd4362ef4b132e4a673136cc61a0efbd;hp=0000000000000000000000000000000000000000;hb=5359ad5c181e5772f350fe1cba060cbed3a05b91;hpb=04a60b34fc18ea3a2638893eaf24514177692eeb diff --git a/src/types/const_type.h b/src/types/const_type.h new file mode 100644 index 0000000..af9efb7 --- /dev/null +++ b/src/types/const_type.h @@ -0,0 +1,21 @@ +#ifndef _PSI_TYPES_CONST_TYPE_H +#define _PSI_TYPES_CONST_TYPE_H + +typedef struct const_type { + token_t type; + char *name; +} const_type; + +static inline const_type *init_const_type(token_t type, const char *name) { + const_type *ct = calloc(1, sizeof(*ct)); + ct->type = type; + ct->name = strdup(name); + return ct; +} + +static inline void free_const_type(const_type *type) { + free(type->name); + free(type); +} + +#endif