aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-03-07 20:36:15 +0000
committergingerBill <bill@gingerbill.org>2018-03-07 20:36:15 +0000
commitfff4ead96ab7cab8091f990e6a947a08a23fd3a4 (patch)
treec139992fb1960487f6d47ed5209461e77edf8b85 /src
parentf4cf88c2ca4411d15fda754344f9ca7d3de6b8ab (diff)
Fix gb_alloc_str_len
Diffstat (limited to 'src')
-rw-r--r--src/gb/gb.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h
index c9db17a2a..bb6ee6106 100644
--- a/src/gb/gb.h
+++ b/src/gb/gb.h
@@ -4027,10 +4027,10 @@ gb_inline void *gb_resize (gbAllocator a, void *ptr, isize old_size, isize
gb_inline void *gb_resize_align(gbAllocator a, void *ptr, isize old_size, isize new_size, isize alignment) { return a.proc(a.data, gbAllocation_Resize, new_size, alignment, ptr, old_size, GB_DEFAULT_ALLOCATOR_FLAGS); }
gb_inline void *gb_alloc_copy (gbAllocator a, void const *src, isize size) {
- return gb_memcopy(gb_alloc(a, size), src, size);
+ return gb_memmove(gb_alloc(a, size), src, size);
}
gb_inline void *gb_alloc_copy_align(gbAllocator a, void const *src, isize size, isize alignment) {
- return gb_memcopy(gb_alloc_align(a, size, alignment), src, size);
+ return gb_memmove(gb_alloc_align(a, size, alignment), src, size);
}
gb_inline char *gb_alloc_str(gbAllocator a, char const *str) {
@@ -4039,7 +4039,8 @@ gb_inline char *gb_alloc_str(gbAllocator a, char const *str) {
gb_inline char *gb_alloc_str_len(gbAllocator a, char const *str, isize len) {
char *result;
- result = cast(char *)gb_alloc_copy(a, str, len+1);
+ result = cast(char *)gb_alloc(a, len+1);
+ gb_memmove(result, str, len);
result[len] = '\0';
return result;
}