Simplify calling of rsindex() and strsearch()

Remove the 'how' parameter to rsindex(), making it reverse-search for only the first matching character,
as sindex() already does.  There are only two callers, and one already passed a hardcoded value of 1.

Also change rsindex() so that it starts searching at the character BEFORE the passed in position.  This
makes it easier to repeatedly call rsindex() in a loop to search for the Nth matching character, and
also fixes a technical instance of undefined behaviour where a pointer is decremented to point before
the start of the string.

Remove the 'mark' parameter to strsearch().  Instead, always forward-search from the beginning of the
string and reverse-search from the end of the string, as this is what the two callers want anyway.

Bump the module ABI version because these functions are exported to modules.
This commit is contained in:
Kevin Easton
2017-11-23 17:22:38 +11:00
parent de303ba554
commit ba1b9742ec
7 changed files with 36 additions and 49 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2.2]
* Simplify rsindex() and strsearch() exported functions. (caf)
* scr-bx now lists the detached screens if there is more than one that matches
the string supplied by the user. (caf)