api refactoring
[m6w6/ext-psi] / src / types / decl_abi.h
diff --git a/src/types/decl_abi.h b/src/types/decl_abi.h
new file mode 100644 (file)
index 0000000..48731a3
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _PSI_TYPES_DECL_ABI_H
+#define _PSI_TYPES_DECL_ABI_H
+
+typedef struct decl_abi {
+       struct psi_token *token;
+       char *convention;
+} decl_abi;
+
+static inline decl_abi *init_decl_abi(const char *convention) {
+       decl_abi *abi = calloc(1, sizeof(*abi));
+       abi->convention = strdup(convention);
+       return abi;
+}
+
+static inline void free_decl_abi(decl_abi *abi) {
+       if (abi->token) {
+               free(abi->token);
+       }
+       free(abi->convention);
+       free(abi);
+}
+
+#endif