Mercurial > vim
comparison src/scriptfile.c @ 27267:322b79b002b7 v8.2.4162
patch 8.2.4162: Vim9: no error for redefining function with export
Commit: https://github.com/vim/vim/commit/9c7cae66bc21a3dc5c6e60cd64216ce7c9073003
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 20 19:10:25 2022 +0000
patch 8.2.4162: Vim9: no error for redefining function with export
Problem: Vim9: no error for redefining function with export.
Solution: Check for existing function with/without prefix. (closes https://github.com/vim/vim/issues/9577)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 20 Jan 2022 20:15:03 +0100 |
parents | 42561e956a70 |
children | b98c20b53a2d |
comparison
equal
deleted
inserted
replaced
27266:06a2610c1661 | 27267:322b79b002b7 |
---|---|
2188 return NULL; | 2188 return NULL; |
2189 } | 2189 } |
2190 | 2190 |
2191 /* | 2191 /* |
2192 * If in a Vim9 autoload script return "name" with the autoload prefix for the | 2192 * If in a Vim9 autoload script return "name" with the autoload prefix for the |
2193 * script. If successful "name" is freed, the returned name is allocated. | 2193 * script. If successful the returned name is allocated. |
2194 * Otherwise it returns "name" unmodified. | 2194 * Otherwise it returns "name" unmodified. |
2195 */ | 2195 */ |
2196 char_u * | 2196 char_u * |
2197 may_prefix_autoload(char_u *name) | 2197 may_prefix_autoload(char_u *name) |
2198 { | 2198 { |
2219 res = alloc(len); | 2219 res = alloc(len); |
2220 if (res != NULL) | 2220 if (res != NULL) |
2221 { | 2221 { |
2222 vim_snprintf((char *)res, len, "%s%s", | 2222 vim_snprintf((char *)res, len, "%s%s", |
2223 si->sn_autoload_prefix, basename); | 2223 si->sn_autoload_prefix, basename); |
2224 vim_free(name); | |
2225 return res; | 2224 return res; |
2226 } | 2225 } |
2227 } | 2226 } |
2228 } | 2227 } |
2229 return name; | 2228 return name; |