comparison src/misc1.c @ 19181:94eda51ba9ba v8.2.0149

patch 8.2.0149: maintaining a Vim9 branch separately is more work Commit: https://github.com/vim/vim/commit/8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 26 15:56:19 2020 +0100 patch 8.2.0149: maintaining a Vim9 branch separately is more work Problem: Maintaining a Vim9 branch separately is more work. Solution: Merge the Vim9 script changes.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Jan 2020 16:00:05 +0100
parents 80b40bd5ec1a
children 9dc843109c97
comparison
equal deleted inserted replaced
19180:8edf0aeb71b9 19181:94eda51ba9ba
2065 */ 2065 */
2066 char_u * 2066 char_u *
2067 concat_str(char_u *str1, char_u *str2) 2067 concat_str(char_u *str1, char_u *str2)
2068 { 2068 {
2069 char_u *dest; 2069 char_u *dest;
2070 size_t l = STRLEN(str1); 2070 size_t l = str1 == NULL ? 0 : STRLEN(str1);
2071 2071
2072 dest = alloc(l + STRLEN(str2) + 1L); 2072 dest = alloc(l + (str2 == NULL ? 0 : STRLEN(str2)) + 1L);
2073 if (dest != NULL) 2073 if (dest != NULL)
2074 { 2074 {
2075 STRCPY(dest, str1); 2075 if (str1 == NULL)
2076 STRCPY(dest + l, str2); 2076 *dest = NUL;
2077 else
2078 STRCPY(dest, str1);
2079 if (str2 != NULL)
2080 STRCPY(dest + l, str2);
2077 } 2081 }
2078 return dest; 2082 return dest;
2079 } 2083 }
2080 2084
2081 static void 2085 static void