diff options
| author | Tyge Lovset <[email protected]> | 2023-06-08 06:55:42 +0200 |
|---|---|---|
| committer | Tyge Lovset <[email protected]> | 2023-06-08 06:55:42 +0200 |
| commit | abd3b4372dee2291a81271f02588228279139960 (patch) | |
| tree | b60b14a94e2c7f676ffe152174e6ba237e731e20 /include/stc/cstr.h | |
| parent | 2bac1dff09459ce55f6e6813af96f845a8c981a1 (diff) | |
| download | STC-modified-abd3b4372dee2291a81271f02588228279139960.tar.gz STC-modified-abd3b4372dee2291a81271f02588228279139960.zip | |
More small adjustments.
Diffstat (limited to 'include/stc/cstr.h')
| -rw-r--r-- | include/stc/cstr.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/stc/cstr.h b/include/stc/cstr.h index d496b85e..03eefd2f 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -504,7 +504,8 @@ STC_DEF char* cstr_reserve(cstr* self, const intptr_t cap) { if (cap > cstr_s_cap) { char* data = (char *)c_malloc(cap + 1); const intptr_t len = cstr_s_size(self); - c_memcpy(data, self->sml.data, cstr_s_cap + 1); + /* copy full short buffer to emulate realloc() */ + c_memcpy(data, self->sml.data, cstr_s_cap + 2); self->lon.data = data; self->lon.size = (size_t)len; cstr_l_set_cap(self, cap); |
