summaryrefslogtreecommitdiff
path: root/src/std/str.c
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-13 20:29:27 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-08-13 20:29:27 +1000
commit567d384b698151e287e31140709c93f1b92e6db4 (patch)
treee00975124d3f002a8aaa22e85475d913c6950346 /src/std/str.c
parent13949ca02bcf9fcdfcc48ea7949f617553a260b6 (diff)
loading joints and animations
Diffstat (limited to 'src/std/str.c')
-rw-r--r--src/std/str.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/std/str.c b/src/std/str.c
index 2aac15f..89c76a0 100644
--- a/src/std/str.c
+++ b/src/std/str.c
@@ -1,6 +1,7 @@
#include "str.h"
#include <assert.h>
#include <string.h>
+#include "log.h"
#include "mem.h"
Str8 Str8_create(u8* buf, size_t len) { return (Str8){ .buf = buf, .len = len }; }
@@ -33,6 +34,15 @@ char* Str8_to_cstr(arena* a, Str8 s) {
return (char*)dest;
}
+char* Clone_cstr(arena* a, const char* s) {
+ if (s == NULL) {
+ WARN("Tried to clone a NULL char*");
+ return NULL;
+ }
+ Str8 st = Str8_cstr_view(s);
+ return Str8_to_cstr(a, st);
+}
+
Str8 Str8_concat(arena* a, Str8 left, Str8 right) {
size_t n_bytes = left.len + right.len + 1;