summaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-26 15:56:19 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-26 15:56:19 +0100
commit8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8 (patch)
tree8e5f241129a1c690ea81d697a72fb4c1704c0cb6 /src/misc1.c
parent1d9215b9aaa120b9d78fee49488556f73007ce78 (diff)
downloadvim-git-8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8.tar.gz
patch 8.2.0149: maintaining a Vim9 branch separately is more workv8.2.0149
Problem: Maintaining a Vim9 branch separately is more work. Solution: Merge the Vim9 script changes.
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/misc1.c b/src/misc1.c
index fb75e1930..85ab727d3 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -2067,13 +2067,17 @@ match_user(char_u *name)
concat_str(char_u *str1, char_u *str2)
{
char_u *dest;
- size_t l = STRLEN(str1);
+ size_t l = str1 == NULL ? 0 : STRLEN(str1);
- dest = alloc(l + STRLEN(str2) + 1L);
+ dest = alloc(l + (str2 == NULL ? 0 : STRLEN(str2)) + 1L);
if (dest != NULL)
{
- STRCPY(dest, str1);
- STRCPY(dest + l, str2);
+ if (str1 == NULL)
+ *dest = NUL;
+ else
+ STRCPY(dest, str1);
+ if (str2 != NULL)
+ STRCPY(dest + l, str2);
}
return dest;
}