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