summaryrefslogtreecommitdiff
path: root/lib/string/memset.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string/memset.c')
-rw-r--r--lib/string/memset.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/string/memset.c b/lib/string/memset.c
new file mode 100644
index 0000000..59e3bea
--- /dev/null
+++ b/lib/string/memset.c
@@ -0,0 +1,14 @@
+#include <stddef.h>
+#include <string.h>
+
+void *
+memset(void *s, int c, size_t n)
+{
+ char *xs = s;
+
+ while (n--)
+ *xs++ = c;
+
+ return s;
+}
+