api refactoring
[m6w6/ext-psi] / src / types / decl_abi.h
1 #ifndef _PSI_TYPES_DECL_ABI_H
2 #define _PSI_TYPES_DECL_ABI_H
3
4 typedef struct decl_abi {
5 struct psi_token *token;
6 char *convention;
7 } decl_abi;
8
9 static inline decl_abi *init_decl_abi(const char *convention) {
10 decl_abi *abi = calloc(1, sizeof(*abi));
11 abi->convention = strdup(convention);
12 return abi;
13 }
14
15 static inline void free_decl_abi(decl_abi *abi) {
16 if (abi->token) {
17 free(abi->token);
18 }
19 free(abi->convention);
20 free(abi);
21 }
22
23 #endif