summaryrefslogtreecommitdiff
path: root/qstd/str.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-30 12:18:55 +1100
committerquou <quou@disroot.org>2024-12-30 12:18:55 +1100
commit90eed5c3684a6dd751afc2bcb7ae0ac919c143a8 (patch)
treed8e275e1d45235b4053e33b934dd2fa3ad98ed9d /qstd/str.c
parent112680014408ab946ad56001dfe53a7035f82d2c (diff)
dup_string function that takes a heap
Diffstat (limited to 'qstd/str.c')
-rw-r--r--qstd/str.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/qstd/str.c b/qstd/str.c
index 5dd97c4..5461880 100644
--- a/qstd/str.c
+++ b/qstd/str.c
@@ -58,3 +58,9 @@ char* dup_string(Arena* a, const char* s) {
return d;
}
+char* dup_stringh(struct Heap* h, const char* s) {
+ int size = string_len(s) + 1;
+ char* d = heap_alloc_aligned(h, size, 1);
+ string_copy(d, s);
+ return d;
+}