diff options
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/strings.c b/src/strings.c index f9c4e2f1db..87d5cc37c5 100644 --- a/src/strings.c +++ b/src/strings.c @@ -534,3 +534,17 @@ int has_non_ascii(char_u *s) return FALSE; } #endif + +/* + * Concatenate two strings and return the result in allocated memory. + * Returns NULL when out of memory. + */ +char_u *concat_str(char_u *str1, char_u *str2) +{ + size_t l = STRLEN(str1); + char_u *dest = xmalloc(l + STRLEN(str2) + 1); + STRCPY(dest, str1); + STRCPY(dest + l, str2); + return dest; +} + |