vis

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

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

commit fb98a3fad49ffd7947cc3c3bdf4913dfae398ccf
parent ddc4ef4b5d0d7e78e0152fa330a7f2f52160e7fe
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 30 Sep 2020 10:34:08 +0200

text: mark text_byte(s)_get argument as const

Diffstat:
Mtext.c | 4++--
Mtext.h | 4++--
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/text.c b/text.c @@ -1604,11 +1604,11 @@ bool text_iterator_char_prev(Iterator *it, char *c) { return true; } -bool text_byte_get(Text *txt, size_t pos, char *byte) { +bool text_byte_get(const Text *txt, size_t pos, char *byte) { return text_bytes_get(txt, pos, 1, byte); } -size_t text_bytes_get(Text *txt, size_t pos, size_t len, char *buf) { +size_t text_bytes_get(const Text *txt, size_t pos, size_t len, char *buf) { if (!buf) return 0; char *cur = buf; diff --git a/text.h b/text.h @@ -221,7 +221,7 @@ size_t text_lineno_by_pos(Text*, size_t pos); * return an artificial NUL byte at EOF. * @endrst */ -bool text_byte_get(Text*, size_t pos, char *byte); +bool text_byte_get(const Text*, size_t pos, char *byte); /** * Store at most ``len`` bytes starting from ``pos`` into ``buf``. * @param pos The absolute starting position. @@ -232,7 +232,7 @@ bool text_byte_get(Text*, size_t pos, char *byte); * .. warning:: ``buf`` will not be NUL terminated. * @endrst */ -size_t text_bytes_get(Text*, size_t pos, size_t len, char *buf); +size_t text_bytes_get(const Text*, size_t pos, size_t len, char *buf); /** * Fetch text range into newly allocate memory region. * @param pos The absolute starting position.