Do comparison using appropriate casting first, as per SUSv3 (search for first
[last] character, not int).
This commit is contained in:
parent
af7552658b
commit
dee551158f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123584
@ -52,8 +52,9 @@ index
|
||||
#endif
|
||||
(const char *p, int ch)
|
||||
{
|
||||
char c = ch;
|
||||
for (;; ++p) {
|
||||
if (*p == ch)
|
||||
if (*p == c)
|
||||
return ((char *)p);
|
||||
if (*p == '\0')
|
||||
return (NULL);
|
||||
|
@ -53,9 +53,10 @@ rindex
|
||||
(const char *p, int ch)
|
||||
{
|
||||
char *save;
|
||||
char c = ch;
|
||||
|
||||
for (save = NULL;; ++p) {
|
||||
if (*p == ch)
|
||||
if (*p == c)
|
||||
save = (char *)p;
|
||||
if (*p == '\0')
|
||||
return (save);
|
||||
|
Loading…
Reference in New Issue
Block a user