diff options
author | Marvin Borner | 2021-04-27 16:24:24 +0200 |
---|---|---|
committer | Marvin Borner | 2021-04-27 16:24:24 +0200 |
commit | 7c047df78502d53411fef09c6e39540d2b7e796a (patch) | |
tree | 00a72bb40f81e7294cb1dde776159ed219ee4967 /src/warnings.c | |
parent | 60e7b5069d5936546356053f85008a5a02bb473a (diff) |
Fixed some overflows and enabled live parsing
Diffstat (limited to 'src/warnings.c')
-rw-r--r-- | src/warnings.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/warnings.c b/src/warnings.c index da8d11b..47566ba 100644 --- a/src/warnings.c +++ b/src/warnings.c @@ -33,14 +33,20 @@ void warnings_add(struct context *ctx, const char *fmt, ...) warning_index++; } -static void warnings_generate_name(u32 i) { +static void warnings_generate_name(u32 i) +{ static u32 ctr = 0; snprintf(warnings[i].name, 8, "%d", ctr++); } +void warnings_remove_marks(void) +{ + gui_remove_line_marker("warning"); +} + void warnings_print(void) { - gui_remove_line_marker("error"); + warnings_remove_marks(); for (u32 i = 0; i < WARNING_COUNT; i++) { if (!warnings[i].exists) continue; @@ -48,8 +54,8 @@ void warnings_print(void) printf("Line %d:%d: %s\n", warnings[i].ctx.line, warnings[i].ctx.column, warnings[i].text); warnings_generate_name(i); - gui_add_line_marker(warnings[i].ctx.line - 1, warnings[i].name, warnings[i].text, "error", - "dialog-warning", (GdkRGBA){ 1, 0, 0, .3 }); + gui_add_line_marker(warnings[i].ctx.line - 1, warnings[i].text, warnings[i].name, + "warning", "dialog-warning", (GdkRGBA){ 1, 0, 0, .3 }); } } @@ -60,6 +66,8 @@ u8 warnings_exist(void) void warnings_clear(void) { - if (warning_index) + if (warnings_exist()) { memset(warnings, 0, sizeof(warnings)); + warning_index = 0; + } } |