vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit b7de6900fa0460c2f9d036365ca3a4ce40e714ef
parent 35fd3f37280693cc6686a358aad642802031070f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 23 Oct 2020 13:07:53 +0200

text: simplify iterator_init

This was added in 18c7be777d15f17f8709b1ab6c6dd5767de5c4e4 to work around
a possibly bogus tis-interpreter warning regarding multiple accesses
in the same expression.

Diffstat:
Mtext.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/text.c b/text.c @@ -799,14 +799,13 @@ bool text_mmaped(const Text *txt, const char *ptr) { } static bool iterator_init(Iterator *it, size_t pos, Piece *p, size_t off) { - Iterator iter = (Iterator){ + *it = (Iterator){ .pos = pos, .piece = p, .start = p ? p->data : NULL, .end = p && p->data ? p->data + p->len : NULL, .text = p && p->data ? p->data + off : NULL, }; - *it = iter; return text_iterator_valid(it); }