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.
inv_strpbrk() is the inverse of the standard function strpbrk().
Calls to sindex() where both strings are not NULL and the second string begins with ^ are equivalent
to calls to inv_strpbrk() (but without the ^). Convert those calls.
The old code could move the variable 'pointer' backwards one character before the start
of the string (then incremented it again before returning). Formally this is undefined
behaviour, so fix it.
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an
accidental mismatch between the length of the prefix being tested and the length actually passed to
strncmp().
This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old
code used an incorrect length of 4.
irc_std.h is where these belong - it's where the normal declarations (via the system headers) come from on
systems which don't need the compat functions.
This is preferable to using time_diff() to compare two timevals, because
time_diff() gives its result as a 'double' which only has 53 bits of
precision.
Also switch a couple of places from using time_diff() to using
this function.
Define USE_NON_CONST so that the newer TCL headers define functions in the
same way as pre-8.4 TCL headers. It will be a good idea to change to
USE_COMPAT_CONST instead at some point.
Also use ckfree() instead of free() to free an allocation returned by TCL.
Adding these in preparation for converting server->connect_time from time_t
to struct timeval. Also converts three existing open-coded versions over to
the new functions.
that don't provide the POSIX setenv().
This fixes building plugins that link to compat.c on OS X (shared libraries on
OS X don't have direct access to environ). It also reduces the binary size on
platforms which provide setenv(), which these days is most of them.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@382 13b04d17-f746-0410-82c6-800466cd88b0
client purposes. The RANDOM_SOURCE setting now only affects the $rand()
scripting function.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@357 13b04d17-f746-0410-82c6-800466cd88b0
This includes all of the underlying support, but doesn't hook it up to the
/SERVER command yet, so it's not useable at this point.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@216 13b04d17-f746-0410-82c6-800466cd88b0
like x86-64, where sizeof(int) != sizeof (void *). This involves correctly
casting every function pointer from the global table to the correct
function type, which has the added benefit of allowing type-checking of
function arguments and return values.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@26 13b04d17-f746-0410-82c6-800466cd88b0