diff options
author | Chris Robinson <[email protected]> | 2018-09-02 21:15:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-09-02 21:15:21 -0700 |
commit | 3b4f28d173d21bad20f28ec41f594f88459596dd (patch) | |
tree | 471e0219797889d8a035a6c19dcd99d93e418038 | |
parent | b854f4037f551bbe42030f155084a2a5c0a1addc (diff) |
Avoid double-resizing when appending a char to a string
-rw-r--r-- | Alc/helpers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c index e7f12a5f..d2cb6253 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -1105,8 +1105,8 @@ void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_ void alstr_append_char(al_string *str, const al_string_char_type c) { size_t len = alstr_length(*str); - VECTOR_RESIZE(*str, len, len+2); - VECTOR_PUSH_BACK(*str, c); + VECTOR_RESIZE(*str, len+1, len+2); + VECTOR_BACK(*str) = c; VECTOR_ELEM(*str, len+1) = 0; } |