Do comparison using appropriate casting first, as per SUSv3 (search for first

[last] character, not int).
This commit is contained in:
Jordan K. Hubbard 2003-12-17 02:46:48 +00:00
parent af7552658b
commit dee551158f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123584
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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);