aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2025-12-13 09:38:53 -0700
committerRandy Palamar <randy@rnpnr.xyz>2025-12-22 09:13:47 -0700
commitdd29e2f4321bea25c53af5def7a23fe57640de50 (patch)
treee551785b024639f560ff4709c94fe8704e06bd4d
parent569b61137cf45521d9fd4f693cf841be485dd4b8 (diff)
downloadvis-dd29e2f4321bea25c53af5def7a23fe57640de50.tar.gz
vis-dd29e2f4321bea25c53af5def7a23fe57640de50.tar.xz
silence new gcc warnings
-rw-r--r--text-objects.c6
-rw-r--r--vis-operators.c2
-rw-r--r--vis.c4
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);
diff --git a/vis.c b/vis.c
index 5bf2d6e..5d1591d 100644
--- a/vis.c
+++ b/vis.c
@@ -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);