[SeaBIOS] [PATCH 3/9] Add strchr() function.

Gleb Natapov gleb at redhat.com
Fri Dec 24 16:43:26 CET 2010


On Fri, Dec 24, 2010 at 10:41:45AM -0500, Kevin O'Connor wrote:
> On Thu, Dec 23, 2010 at 11:29:37AM +0200, Gleb Natapov wrote:
> > 
> > Signed-off-by: Gleb Natapov <gleb at redhat.com>
> > ---
> >  src/util.c |   11 +++++++++++
> >  src/util.h |    1 +
> >  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> How about this instead?
> 
OK. The result is the same :)

> -Kevin
> 
> 
> --- a/src/util.c
> +++ b/src/util.c
> @@ -262,6 +262,15 @@ strtcpy(char *dest, const char *src, size_t len)
>      return dest;
>  }
>  
> +// locate first occurance of character c in the string s
> +char *
> +strchr(const char *s, int c)
> +{
> +    for (; *s; s++)
> +        if (*s == c)
> +            return (char*)s;
> +    return NULL;
> +}
>  
>  /****************************************************************
>   * Keyboard calls
> diff --git a/src/util.h b/src/util.h
> index fa7b20f..f5b9446 100644
> --- a/src/util.h
> +++ b/src/util.h
> @@ -209,6 +209,7 @@ void *memcpy(void *d1, const void *s1, size_t len);
>  void iomemcpy(void *d, const void *s, u32 len);
>  void *memmove(void *d, const void *s, size_t len);
>  char *strtcpy(char *dest, const char *src, size_t len);
> +char *strchr(const char *s, int c);
>  int get_keystroke(int msec);
>  
>  // stacks.c

--
			Gleb.



More information about the SeaBIOS mailing list