api refactoring
[m6w6/ext-psi] / src / types / const_type.h
diff --git a/src/types/const_type.h b/src/types/const_type.h
new file mode 100644 (file)
index 0000000..af9efb7
--- /dev/null
@@ -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