Re: [Tinyx-devel] [PATCH] LIBC: memset and memcpy
Status: Planning
Brought to you by:
davidcohen
|
From: David C. <da...@gm...> - 2008-01-10 01:25:59
|
On Jan 9, 2008 11:40 AM, Felipe Balbi <me...@fe...> wrote:
> string.c is mostly complete now, we shall need strerror though
> during debugging but this can be done in a separate file.
>
> Signed-off-by: Felipe Balbi <me...@fe...>
Acked.
Br,
David
> ---
> include/libc/string.h | 2 ++
> lib/libc/string.c | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/include/libc/string.h b/include/libc/string.h
> index 9106e7a..8a53d41 100644
> --- a/include/libc/string.h
> +++ b/include/libc/string.h
> @@ -22,6 +22,8 @@
> #ifndef __TINYX_LIBC_STRING_H
> #define __TINYX_LIBC_STRING_H
>
> +void *memset(void *mem, int data, size_t count)
> +void *memcpy(void *dest, const void *src, size_t count)
> char *strcat(char *str1, const char *str2);
> char *strchr(const char *str, int ch);
> int strcoll(const char *str1, const char *str2);
> diff --git a/lib/libc/string.c b/lib/libc/string.c
> index f54a876..0b9be1c 100644
> --- a/lib/libc/string.c
> +++ b/lib/libc/string.c
> @@ -22,6 +22,37 @@
> #include <libc/string.h>
>
> /**
> + * memset - Fill a memory region with data
> + * @mem: Pointer to the start of the area.
> + * @data: The byte to fill the area with
> + * @count: The size of the area.
> + */
> +void *memset(void *mem, int data, size_t count)
> +{
> + char *tmp = mem;
> +
> + while (count--)
> + *tmp++ = data;
> + return mem;
> +}
> +
> +/**
> + * memcpy - Copy memory areas
> + * @dest: Destination of copy task
> + * @src: Where the data to copy from is
> + * @count: The size of the area.
> + */
> +void *memcpy(void *dest, const void *src, size_t count)
> +{
> + char *tmp = dest;
> + const char *s = src;
> +
> + while (count--)
> + *tmp++ = *s++;
> + return dest;
> +}
> +
> +/**
> * strcat - Apend one string to another
> * @str1: The destination string
> * @str2: The source string
> --
> 1.5.4.rc1.21.g0e545-dirty
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Tinyx-devel mailing list
> Tin...@li...
> https://lists.sourceforge.net/lists/listinfo/tinyx-devel
>
--
David Cohen
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
|