diff options
Diffstat (limited to 'src/garray.c')
-rw-r--r-- | src/garray.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/garray.c b/src/garray.c index 8871a8637c..1d9195d7ab 100644 --- a/src/garray.c +++ b/src/garray.c @@ -142,15 +142,19 @@ char_u* ga_concat_strings(const garray_T *gap) } /// Concatenate a string to a growarray which contains characters. -/// Note: Does NOT copy the NUL at the end! +/// +/// WARNING: +/// - Does NOT copy the NUL at the end! +/// - The parameter may not overlap with the growing array /// /// @param gap /// @param s -void ga_concat(garray_T *gap, char_u *s) +void ga_concat(garray_T *gap, const char_u *restrict s) { - int len = (int)STRLEN(s); + int len = (int)strlen((char *) s); ga_grow(gap, len); - memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len); + char *data = gap->ga_data; + memcpy(data + gap->ga_len, s, (size_t) len); gap->ga_len += len; } |