From d2004b15f1e90efafedc367335c07ad4636d291d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 7 Apr 2017 16:04:40 +0200 Subject: text: add mem{r,}chr(3) based byte search functions These are generally implemented efficiently in libc. While memrchr(3) is non-standard, it is a common extension. If it is not available, we use a simple C implementation from musl. --- text.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'text.h') diff --git a/text.h b/text.h index 0e372c1..c2a5812 100644 --- a/text.h +++ b/text.h @@ -97,6 +97,8 @@ bool text_iterator_byte_prev(Iterator*, char *b); /* if the new position is at EOF a NUL byte (which is not actually * part of the file) is read. */ bool text_iterator_byte_next(Iterator*, char *b); +bool text_iterator_byte_find_prev(Iterator*, char b); +bool text_iterator_byte_find_next(Iterator*, char b); /* move to the next/previous UTF-8 encoded Unicode codepoint * and set c (if it is non NULL) to the first byte */ bool text_iterator_codepoint_next(Iterator *it, char *c); -- cgit v1.2.3