summaryrefslogtreecommitdiffstats
path: root/lib/libc/string
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-08-28 16:20:17 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-08-28 16:20:17 -0400
commitc92305221770bb1316d026c200d569ca4e930e42 (patch)
treebf3e496991e74bd6f2415cf156a7226729f0058b /lib/libc/string
parent69f2ee15025ccedaae0308c50b7d0d400b854c5b (diff)
downloadjove-os-c92305221770bb1316d026c200d569ca4e930e42.tar.gz
jove-os-c92305221770bb1316d026c200d569ca4e930e42.tar.bz2
jove-os-c92305221770bb1316d026c200d569ca4e930e42.zip
merge libc files, new init methods for libjove
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/memcpy.c10
-rw-r--r--lib/libc/string/memset.c7
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c
new file mode 100644
index 0000000..f71444d
--- /dev/null
+++ b/lib/libc/string/memcpy.c
@@ -0,0 +1,10 @@
+#include <stddef.h>
+
+void*
+memcpy(void *dest, const void *src, size_t n)
+{
+ const unsigned char *s = src;
+ for(unsigned char *d = dest; n; n--)
+ *(d++) = *(s++);
+ return dest;
+}
diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c
new file mode 100644
index 0000000..f79a4b4
--- /dev/null
+++ b/lib/libc/string/memset.c
@@ -0,0 +1,7 @@
+#include <stddef.h>
+
+void
+memset(void *s, int c, size_t n)
+{
+ for(unsigned char *sb = s; n; n--) *(sb++) = c;
+}