diff options
| -rw-r--r-- | text-objects.c | 6 | ||||
| -rw-r--r-- | vis-operators.c | 2 | ||||
| -rw-r--r-- | vis.c | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/text-objects.c b/text-objects.c index 5e724b8..37e6980 100644 --- a/text-objects.c +++ b/text-objects.c @@ -176,7 +176,7 @@ static bool text_line_blank(Text *txt, size_t pos) { } Filerange text_object_paragraph(Text *txt, size_t pos) { - char c; + char c = 0; Filerange r; if (text_line_blank(txt, pos)) { Iterator it = text_iterator_get(txt, pos), rit = it; @@ -315,6 +315,10 @@ Filerange text_object_indentation(Text *txt, size_t pos) { size_t line_indent = sol - bol; bool line_empty = text_byte_get(txt, bol, &c) && c == '\n'; + /* NOTE: gcc spits a warning otherwise, this is probably not possible but something + * about how text_line_{begin,start} are implemented makes gcc think otherwise */ + line_indent = MIN(line_indent, PTRDIFF_MAX); + char *buf = text_bytes_alloc0(txt, bol, line_indent); char *tmp = malloc(line_indent); diff --git a/vis-operators.c b/vis-operators.c index ae2da5a..d2b42d3 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -99,7 +99,7 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { } static size_t op_shift_right(Vis *vis, Text *txt, OperatorContext *c) { - char spaces[9] = " "; + char spaces[9] = " "; spaces[MIN(vis->win->view.tabwidth, LENGTH(spaces) - 1)] = '\0'; const char *tab = vis->win->expandtab ? spaces : "\t"; size_t tablen = strlen(tab); @@ -627,13 +627,13 @@ void vis_cleanup(Vis *vis) register_release(&vis->registers[i]); ui_terminal_free(&vis->ui); if (vis->usercmds) { - const char *name; + const char *name = 0; while (map_first(vis->usercmds, &name) && vis_cmd_unregister(vis, name)); } map_free(vis->usercmds); map_free(vis->cmds); if (vis->options) { - const char *name; + const char *name = 0; while (map_first(vis->options, &name) && vis_option_unregister(vis, name)); } map_free(vis->options); |
