aboutsummaryrefslogtreecommitdiff
path: root/text-objects.c
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 /text-objects.c
parent569b61137cf45521d9fd4f693cf841be485dd4b8 (diff)
downloadvis-dd29e2f4321bea25c53af5def7a23fe57640de50.tar.gz
vis-dd29e2f4321bea25c53af5def7a23fe57640de50.tar.xz
silence new gcc warnings
Diffstat (limited to 'text-objects.c')
-rw-r--r--text-objects.c6
1 files changed, 5 insertions, 1 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);