2009-11-01 Robert Millan <rmh.grub@aybabtu.com>
Based on patch from BVK Chaitanya <bvk.groups@gmail.com> * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0' case.
This commit is contained in:
parent
5b1538672e
commit
a50569e135
2 changed files with 11 additions and 5 deletions
10
kern/misc.c
10
kern/misc.c
|
@ -223,12 +223,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
|
|||
char *
|
||||
grub_strchr (const char *s, int c)
|
||||
{
|
||||
while (*s)
|
||||
do
|
||||
{
|
||||
if (*s == c)
|
||||
return (char *) s;
|
||||
s++;
|
||||
}
|
||||
while (*s++);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -236,14 +236,14 @@ grub_strchr (const char *s, int c)
|
|||
char *
|
||||
grub_strrchr (const char *s, int c)
|
||||
{
|
||||
char *p = 0;
|
||||
char *p = NULL;
|
||||
|
||||
while (*s)
|
||||
do
|
||||
{
|
||||
if (*s == c)
|
||||
p = (char *) s;
|
||||
s++;
|
||||
}
|
||||
while (*s++);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue