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:
@@ -194,8 +194,8 @@ void add_to_history(char *line)
|
||||
{
|
||||
while (line && *line)
|
||||
{
|
||||
if ((ptr = sindex(line, "\n\r")) != NULL)
|
||||
*(ptr++) = '\0';
|
||||
if ((ptr = strpbrk(line, "\r\n")) != NULL)
|
||||
*ptr++ = '\0';
|
||||
add_to_history_list(hist_count, line);
|
||||
last_dir = PREV;
|
||||
hist_count++;
|
||||
|
||||
Reference in New Issue
Block a user