diff options
-rw-r--r-- | error/include/error.h | 24 | ||||
-rw-r--r-- | error/src/error.c | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/error/include/error.h b/error/include/error.h index 92c06ff..23df5f3 100644 --- a/error/include/error.h +++ b/error/include/error.h | |||
@@ -6,17 +6,17 @@ | |||
6 | /// Get the last error. | 6 | /// Get the last error. |
7 | const char* get_error(void); | 7 | const char* get_error(void); |
8 | 8 | ||
9 | extern xlstring gfx_error; | 9 | extern xlstring g_error; |
10 | 10 | ||
11 | /// Set the last error. | 11 | /// Log an error. |
12 | #define set_error(...) \ | 12 | #define log_error(...) \ |
13 | gfx_error.length = snprintf(gfx_error.str, xlstring_size, __VA_ARGS__) | 13 | { \ |
14 | 14 | if (g_error.length == 0) { \ | |
15 | /// Prepend an error to the last error. | 15 | g_error.length = snprintf(g_error.str, xlstring_size, __VA_ARGS__); \ |
16 | #define prepend_error(...) \ | 16 | } else { \ |
17 | { \ | 17 | xlstring head; \ |
18 | xlstring head; \ | 18 | head.length = snprintf(head.str, xlstring_size, __VA_ARGS__); \ |
19 | head.length = snprintf(head.str, xlstring_size, __VA_ARGS__); \ | 19 | xlstring_append(&head, xlstring_make(": ")); \ |
20 | xlstring_append(&head, xlstring_make(": ")); \ | 20 | g_error = xlstring_concat(head, g_error); \ |
21 | gfx_error = xlstring_concat(head, gfx_error); \ | 21 | } \ |
22 | } | 22 | } |
diff --git a/error/src/error.c b/error/src/error.c index ccd850d..81fb056 100644 --- a/error/src/error.c +++ b/error/src/error.c | |||
@@ -1,5 +1,5 @@ | |||
1 | #include "error.h" | 1 | #include "error.h" |
2 | 2 | ||
3 | xlstring gfx_error; | 3 | xlstring g_error; |
4 | 4 | ||
5 | const char* get_error(void) { return xlstring_cstr(&gfx_error); } | 5 | const char* get_error(void) { return xlstring_cstr(&g_error); } |