scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit f8fd3858424b64391e582fc7e53f8a63ee113d98
parent 446d6cf7334ec3d1532ab59611d58889467c5004
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 16 Feb 2017 22:42:42 +0100

[libc] Add memset()

Diffstat:
Mlibc/src/Makefile | 3++-
Alibc/src/memset.c | 13+++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libc/src/Makefile b/libc/src/Makefile @@ -2,7 +2,8 @@ .POSIX: LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \ - strrchr.o strcat.o strncpy.o strncat.o + strrchr.o strcat.o strncpy.o strncat.o \ + memset.o all: libc.a diff --git a/libc/src/memset.c b/libc/src/memset.c @@ -0,0 +1,13 @@ +/* See LICENSE file for copyright and license details. */ + +#include <string.h> + +void * +memset(void *s, int c, size_t n) +{ + char *bp; + + for (bp = s; n-- > 0; *bp++ = c) + /* nothing */; + return s; +}