comparison src/misc2.c @ 21558:1c4d4aa22b37 v8.2.1329

patch 8.2.1329: Vim9: cannot define global function inside :def function Commit: https://github.com/vim/vim/commit/38ddf333f6b2806b0ea2dd052ee1cd50dd7f4525 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 31 22:05:04 2020 +0200 patch 8.2.1329: Vim9: cannot define global function inside :def function Problem: Vim9: cannot define global function inside :def function. Solution: Assign to global variable instead of local. (closes https://github.com/vim/vim/issues/6584)
author Bram Moolenaar <Bram@vim.org>
date Fri, 31 Jul 2020 22:15:04 +0200
parents d64520bfafa0
children 35921b7fc07a
comparison
equal deleted inserted replaced
21557:00c9f8522652 21558:1c4d4aa22b37
2023 int i; 2023 int i;
2024 2024
2025 for (i = 0; i < gap->ga_len; ++i) 2025 for (i = 0; i < gap->ga_len; ++i)
2026 vim_free(((char_u **)(gap->ga_data))[i]); 2026 vim_free(((char_u **)(gap->ga_data))[i]);
2027 ga_clear(gap); 2027 ga_clear(gap);
2028 }
2029
2030 /*
2031 * Copy a growing array that contains a list of strings.
2032 */
2033 int
2034 ga_copy_strings(garray_T *from, garray_T *to)
2035 {
2036 int i;
2037
2038 ga_init2(to, sizeof(char_u *), 1);
2039 if (ga_grow(to, from->ga_len) == FAIL)
2040 return FAIL;
2041
2042 for (i = 0; i < from->ga_len; ++i)
2043 {
2044 char_u *orig = ((char_u **)from->ga_data)[i];
2045 char_u *copy;
2046
2047 if (orig == NULL)
2048 copy = NULL;
2049 else
2050 {
2051 copy = vim_strsave(orig);
2052 if (copy == NULL)
2053 {
2054 to->ga_len = i;
2055 ga_clear_strings(to);
2056 return FAIL;
2057 }
2058 }
2059 ((char_u **)to->ga_data)[i] = copy;
2060 }
2061 to->ga_len = from->ga_len;
2062 return OK;
2028 } 2063 }
2029 2064
2030 /* 2065 /*
2031 * Initialize a growing array. Don't forget to set ga_itemsize and 2066 * Initialize a growing array. Don't forget to set ga_itemsize and
2032 * ga_growsize! Or use ga_init2(). 2067 * ga_growsize! Or use ga_init2().