#ifndef FVM_UTILS_H_ #define FVM_UTILS_H_ #include struct allocator; struct result { void *value; const char* errmsg; }; #define unwrap(x__) ({ \ struct result res__ = (x__); \ if (res__.errmsg != NULL) return res__; \ res__.value;}) struct result ok(void *value); struct result err(const char *errmsg); struct allocator * new_allocator(); void delete_allocator(struct allocator * allocator); void* allocate(struct allocator * allocator, size_t size); char* safe_sprintf(struct allocator *alct, const char* format, ...); #endif // FVM_UTILS_H_