vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit ddc4ef4b5d0d7e78e0152fa330a7f2f52160e7fe parent a678818f0841e652daa4557846f5ff4f4f46ee95 Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 30 Sep 2020 10:31:54 +0200 text: mark text_iterator_get argument as const Diffstat:
| M | text.c | | | 6 | +++--- |
| M | text.h | | | 2 | +- |
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/text.c b/text.c @@ -158,7 +158,7 @@ static Piece *piece_alloc(Text *txt); static void piece_free(Piece *p); static void piece_init(Piece *p, Piece *prev, Piece *next, const char *data, size_t len); static Location piece_get_intern(Text *txt, size_t pos); -static Location piece_get_extern(Text *txt, size_t pos); +static Location piece_get_extern(const Text *txt, size_t pos); /* span management */ static void span_init(Span *span, Piece *start, Piece *end); static void span_swap(Text *txt, Span *old, Span *new); @@ -542,7 +542,7 @@ static Location piece_get_intern(Text *txt, size_t pos) { * it pos is the end of file (== text_size()) and the file is not empty then * the last piece holding data is returned. */ -static Location piece_get_extern(Text *txt, size_t pos) { +static Location piece_get_extern(const Text *txt, size_t pos) { size_t cur = 0; Piece *p; @@ -1402,7 +1402,7 @@ static bool text_iterator_init(Iterator *it, size_t pos, Piece *p, size_t off) { return text_iterator_valid(it); } -Iterator text_iterator_get(Text *txt, size_t pos) { +Iterator text_iterator_get(const Text *txt, size_t pos) { Iterator it; Location loc = piece_get_extern(txt, pos); text_iterator_init(&it, pos, loc.piece, loc.off); diff --git a/text.h b/text.h @@ -249,7 +249,7 @@ char *text_bytes_alloc0(Text*, size_t pos, size_t len); * @defgroup iterator * @{ */ -Iterator text_iterator_get(Text*, size_t pos); +Iterator text_iterator_get(const Text*, size_t pos); Text *text_iterator_text(const Iterator*); bool text_iterator_valid(const Iterator*); bool text_iterator_has_next(const Iterator*);