From 1cf6842543cbbea5564d2908791f3251c60f3d73 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 31 Oct 2015 05:01:07 +0100 Subject: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/string/substring.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/string') diff --git a/src/string/substring.h b/src/string/substring.h index 9d6dbfe..05ef7cc 100644 --- a/src/string/substring.h +++ b/src/string/substring.h @@ -30,6 +30,16 @@ /* The Knuth–Morris–Pratt algorithm. */ +/** + * Test whether to characters are equal. + * Case-sensitivity depends on `CASE` being defined. + * + * @param a One of the characters. + * @param b The other character. + * @return 1 if `a` and `b` or equal, 0 otherwise. + * The comparison is case-insensitive if + * `CASE` is defined. + */ #if !defined(CASE) # define CHREQ(a, b) (a == b) #elif !defined(WIDE) @@ -42,6 +52,8 @@ /* TODO add support for RIGHT */ +/* The implementation of the algorithm, read + * elsewhere for documentation/explanation. */ { ssize_t* next_map = alloca((needle_length + 1) * sizeof(ssize_t)); ssize_t hay, ned, skp; -- cgit v1.2.3-70-g09d2