]> git.corax.cc Git - corax/commitdiff
libc: Add memset() function
authorMatthias Kruk <m@m10k.eu>
Fri, 1 May 2020 09:39:21 +0000 (18:39 +0900)
committerMatthias Kruk <m@m10k.eu>
Fri, 1 May 2020 09:39:21 +0000 (18:39 +0900)
libc/string.c

index 5ae3b1d881706f7c4351757e7773ed710743de8e..af6ea7fbd305de9a4558a6f78d29fc3ae11958f7 100644 (file)
@@ -8,3 +8,16 @@ size_t strlen(const char *s)
 
        return(ret_val);
 }
+
+void *memset(void *s, int c, size_t n)
+{
+       char *ptr;
+
+       ptr = (char*)s;
+
+       while(--n >= 0) {
+               *ptr++ = (char)c;
+       }
+
+       return(s);
+}