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:
robertmh 2009-11-01 23:03:09 +00:00
parent 5b1538672e
commit a50569e135
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
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.
2009-11-01 Felix Zielcke <fzielcke@z-51.de> 2009-11-01 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'. * Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'.

View file

@ -223,12 +223,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
char * char *
grub_strchr (const char *s, int c) grub_strchr (const char *s, int c)
{ {
while (*s) do
{ {
if (*s == c) if (*s == c)
return (char *) s; return (char *) s;
s++;
} }
while (*s++);
return 0; return 0;
} }
@ -236,14 +236,14 @@ grub_strchr (const char *s, int c)
char * char *
grub_strrchr (const char *s, int c) grub_strrchr (const char *s, int c)
{ {
char *p = 0; char *p = NULL;
while (*s) do
{ {
if (*s == c) if (*s == c)
p = (char *) s; p = (char *) s;
s++;
} }
while (*s++);
return p; return p;
} }