Replace uses of sindex() with constant accept strings with strpbrk() / strchr()

sindex(), where neither argument is NULL and the accept string does not start with ^, is exactly equivalent
to the standard function strpbrk().

Further, strpbrk() where the accept string is only one character long, is exactly equivalent to strchr().
This commit is contained in:
Kevin Easton
2017-11-17 16:23:39 +11:00
parent eb6ffc7395
commit 8c7d9334dd
4 changed files with 26 additions and 30 deletions

View File

@@ -832,11 +832,11 @@ static char *cut_n_fix_glob ( char *nickuserhost )
/* doh! */
user = userhost;
if ((host = sindex(userhost, "@")))
if ((host = strchr(userhost, '@')))
/* USER IS CORRECT HERE */
*host++ = 0;
else if (sindex(userhost, "."))
else if (strchr(userhost, '.'))
{
user = "*";
host = userhost;
@@ -850,14 +850,14 @@ static char *cut_n_fix_glob ( char *nickuserhost )
else
{
user = copy;
if ((host = sindex(user, "@")))
if ((host = strchr(user, '@')))
{
nick = "*";
*host++ = 0;
}
else
{
if (sindex(user, "."))
if (strchr(user, '.'))
{
nick = "*";
host = user;