Mercurial > vim
diff src/vim9compile.c @ 27032:18cafa092e8d v8.2.4045
patch 8.2.4045: some global functions are only used in one file
Commit: https://github.com/vim/vim/commit/782b43d89473dac00e3a8e02224a8330b88dbfef
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Jan 8 18:43:40 2022 +0000
patch 8.2.4045: some global functions are only used in one file
Problem: Some global functions are only used in one file.
Solution: Make the functions static. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/9492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 08 Jan 2022 19:45:03 +0100 |
parents | eebbcc83fb75 |
children | 15f40772e10a |
line wrap: on
line diff
--- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -557,6 +557,27 @@ get_script_item_idx(int sid, char_u *nam return -1; } + static imported_T * +find_imported_in_script(char_u *name, size_t len, int sid) +{ + scriptitem_T *si; + int idx; + + if (!SCRIPT_ID_VALID(sid)) + return NULL; + si = SCRIPT_ITEM(sid); + for (idx = 0; idx < si->sn_imports.ga_len; ++idx) + { + imported_T *import = ((imported_T *)si->sn_imports.ga_data) + idx; + + if (len == 0 ? STRCMP(name, import->imp_name) == 0 + : STRLEN(import->imp_name) == len + && STRNCMP(name, import->imp_name, len) == 0) + return import; + } + return NULL; +} + /* * Find "name" in imported items of the current script or in "cctx" if not * NULL. @@ -583,27 +604,6 @@ find_imported(char_u *name, size_t len, return find_imported_in_script(name, len, current_sctx.sc_sid); } - imported_T * -find_imported_in_script(char_u *name, size_t len, int sid) -{ - scriptitem_T *si; - int idx; - - if (!SCRIPT_ID_VALID(sid)) - return NULL; - si = SCRIPT_ITEM(sid); - for (idx = 0; idx < si->sn_imports.ga_len; ++idx) - { - imported_T *import = ((imported_T *)si->sn_imports.ga_data) + idx; - - if (len == 0 ? STRCMP(name, import->imp_name) == 0 - : STRLEN(import->imp_name) == len - && STRNCMP(name, import->imp_name, len) == 0) - return import; - } - return NULL; -} - /* * Free all imported variables. */