api refactoring
[m6w6/ext-psi] / src / types / const_type.h
1 #ifndef _PSI_TYPES_CONST_TYPE_H
2 #define _PSI_TYPES_CONST_TYPE_H
3
4 typedef struct const_type {
5 token_t type;
6 char *name;
7 } const_type;
8
9 static inline const_type *init_const_type(token_t type, const char *name) {
10 const_type *ct = calloc(1, sizeof(*ct));
11 ct->type = type;
12 ct->name = strdup(name);
13 return ct;
14 }
15
16 static inline void free_const_type(const_type *type) {
17 free(type->name);
18 free(type);
19 }
20
21 #endif