aboutsummaryrefslogtreecommitdiff
path: root/MemoryManager.c
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2026-04-28 17:32:18 +0300
committerSyndamia <kamen@syndamia.com>2026-05-12 07:08:56 +0300
commite97bc661483173c23f26880ffef50d02955e73da (patch)
treec1a4eaa02fb075e09e0a679da08b5e145450125a /MemoryManager.c
parenta619dd631c367d60a06a28e81fec634c7d827308 (diff)
downloadfoollib-e97bc661483173c23f26880ffef50d02955e73da.tar
foollib-e97bc661483173c23f26880ffef50d02955e73da.tar.gz
foollib-e97bc661483173c23f26880ffef50d02955e73da.zip
feat: Implement hash table
Diffstat (limited to 'MemoryManager.c')
-rw-r--r--MemoryManager.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/MemoryManager.c b/MemoryManager.c
index 98e70e7..53f906e 100644
--- a/MemoryManager.c
+++ b/MemoryManager.c
@@ -1,6 +1,7 @@
#include "MemoryManager.h"
#include "Types.h"
#include <stdlib.h>
+#include <string.h>
Result
std_alloc(MemoryManager mm, void **ptr, usize size) {
@@ -44,3 +45,19 @@ M_std() {
.destroy = &std_destroy,
};
}
+
+char*
+M_strdup(MemoryManager mm, const char* str) {
+ if (NULL == str)
+ return NULL;
+
+ char* newstr = NULL;
+ if (R_Ok != mm.alloc(mm, (void**)&newstr, strlen(str) + 1) ||
+ NULL == newstr)
+ {
+ return NULL;
+ }
+
+ strcpy(newstr, str);
+ return newstr;
+}