changed Error_create msg argument type to str
This commit is contained in:
@@ -26,7 +26,7 @@ typedef struct Error {
|
||||
List(ErrorCallPos) call_stack;
|
||||
} Error;
|
||||
|
||||
Error* Error_create(const char* msg, bool is_msg_on_heap, ErrorCallPos p,
|
||||
Error* Error_create(str msg, bool is_msg_on_heap, ErrorCallPos p,
|
||||
u16 error_code_page, u32 error_code);
|
||||
void Error_free(Error* e);
|
||||
void Error_addCallPos(Error* e, ErrorCallPos p);
|
||||
@@ -83,9 +83,11 @@ typedef struct Result_ {
|
||||
.u = 0 \
|
||||
}
|
||||
#define RESULT_ERROR_CODE_FMT(CODE_PAGE, CODE, FORMAT, ARGS...) \
|
||||
RESULT_ERROR_CODE(CODE_PAGE, CODE, sprintf_malloc(FORMAT ,##ARGS), true)
|
||||
RESULT_ERROR_CODE(CODE_PAGE, CODE, str_from_cstr(sprintf_malloc(FORMAT ,##ARGS)), true)
|
||||
#define RESULT_ERROR(MSG, IS_MSG_ON_HEAP) \
|
||||
RESULT_ERROR_CODE(NONE, 0, MSG, IS_MSG_ON_HEAP);
|
||||
#define RESULT_ERROR_LITERAL(MSG) \
|
||||
RESULT_ERROR(STR((MSG)), false)
|
||||
#define RESULT_ERROR_FMT(FORMAT, ARGS...) \
|
||||
RESULT_ERROR_CODE_FMT(NONE, 0, FORMAT ,##ARGS)
|
||||
|
||||
@@ -153,4 +155,4 @@ typedef struct Result_ {
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
#define try_assert(EXPR) if(!(EXPR)) { Return RESULT_ERROR(("assertion must be true: " #EXPR), false); }
|
||||
#define try_assert(EXPR) if(!(EXPR)) { Return RESULT_ERROR_LITERAL("assertion must be true: " #EXPR); }
|
||||
|
||||
Reference in New Issue
Block a user