diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/al/wstr.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/al/wstr.h b/include/al/wstr.h index 4c37453..d62a4af 100644 --- a/include/al/wstr.h +++ b/include/al/wstr.h @@ -58,7 +58,7 @@ static inline void al_wstr_free(wstr *w) static inline u32 al_wstr_reserve(wstr *w, u32 size) { - return al_growing_allocation((void **)&w->data, w->alloc, size, al_realloc); + return al_growing_allocation((void **)&w->data, w->alloc, size * sizeof(wchar_t), al_realloc); } static inline void al_wstr_sized(wstr *w, u32 size) @@ -131,7 +131,7 @@ static inline bool al_str_from_wstr(str *s, wstr *w) static inline void al_wstr_cat(wstr *w, wstr *c) { - w->alloc = al_wstr_reserve(w, ((w->length + c->length) + 1) * sizeof(wchar_t)); + w->alloc = al_wstr_reserve(w, w->length + c->length + 1); al_memcpy(w->data + w->length, c->data, c->length * sizeof(wchar_t)); w->length += c->length; w->data[w->length] = L'\0'; @@ -139,7 +139,7 @@ static inline void al_wstr_cat(wstr *w, wstr *c) static inline void al_wstr_insert(wstr *w, u32 index, wstr *c) { - w->alloc = al_wstr_reserve(w, ((w->length + c->length) + 1) * sizeof(wchar_t)); + w->alloc = al_wstr_reserve(w, w->length + c->length + 1); wchar_t *pos = w->data + index; if (index < w->length) { al_memmove(pos + c->length, pos, (w->length - index) * sizeof(wchar_t)); |