From 7126ac1e61c04f400b8178b2090a0a2de2c96637 Mon Sep 17 00:00:00 2001 From: pgen Date: Fri, 27 Nov 2020 14:38:36 +0100 Subject: Improve comments --- index.c | 10 +++++++--- smenu.c | 3 ++- utf8.c | 1 + utils.c | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/index.c b/index.c index 817671f..c1e3f1e 100644 --- a/index.c +++ b/index.c @@ -3,9 +3,13 @@ /* please read http://www.gnu.org/copyleft/gpl.html. */ /* ########################################################### */ -/* Ternary Search Tree and sorted array creation functions */ -/* Inspired by: https://www.cs.princeton.edu/~rs/strings/tstdemo.c. */ -/* **************************************************************** */ +/* Ternary Search Tree and sorted array creation functions. */ +/* Inspired by a code described in "Ternary Search Trees" by Jon */ +/* Bentley and Robert Sedgewick in the April, 1998, Dr. Dobb's Journal. */ +/* Links: */ +/* https://www.drdobbs.com/database/ternary-search-trees/184410528?pgno=1 */ +/* https://www.cs.princeton.edu/~rs/strings/tstdemo.c. */ +/* ************************************************************************ */ #include #include diff --git a/smenu.c b/smenu.c index f28b90b..e75d2d7 100644 --- a/smenu.c +++ b/smenu.c @@ -156,8 +156,9 @@ help(win_t * win, term_t * term, long last_line, toggle_t * toggle) int len; /* length of one of these objects. */ }; - char * arrows = concat(left_arrow, up_arrow, right_arrow, down_arrow, + char * arrows = concat(left_arrow, up_arrow, right_arrow, down_arrow, (char *)0); + struct entry_s entries[] = { { 'n', "Move:", 5 }, { 'b', arrows, 4 }, { 'n', "|", 1 }, { 'b', "h", 1 }, { 'b', "j", 1 }, { 'b', "k", 1 }, diff --git a/utf8.c b/utf8.c index b72d449..6193bde 100644 --- a/utf8.c +++ b/utf8.c @@ -531,6 +531,7 @@ utf8_strprefix(char * d, char * s, long n, long * pos) /* ================================================== */ /* Converts a UTF-8 glyph string to a wchar_t string. */ +/* The returned string must be freed by the caller. */ /* ================================================== */ wchar_t * utf8_strtowcs(char * s) diff --git a/utils.c b/utils.c index 199fcf9..add1346 100644 --- a/utils.c +++ b/utils.c @@ -186,6 +186,7 @@ concat(const char * s1, ...) /* =============================================== */ /* Is the string str2 a prefix of the string str1? */ +/* Returns 1 if true, else 0. */ /* =============================================== */ int strprefix(char * str1, char * str2) -- cgit v1.2.3