aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-03 14:55:00 +0800
committerGitHub <noreply@github.com>2023-01-03 14:55:00 +0800
commit4dd793a256fefb481159f9f93bf7572391e266de (patch)
tree0a4a2c512f38b1e734fdb22650c2929fcd516c65 /src/nvim/eval.c
parent3a519d86bf4d5ef3ff5623ad925ed856266d80de (diff)
downloadrneovim-4dd793a256fefb481159f9f93bf7572391e266de.tar.gz
rneovim-4dd793a256fefb481159f9f93bf7572391e266de.tar.bz2
rneovim-4dd793a256fefb481159f9f93bf7572391e266de.zip
vim-patch:9.0.1132: code is indented more than needed (#21626)
Problem: Code is indented more than needed. Solution: Use an early return to reduce indentation. (Yegappan Lakshmanan, closes vim/vim#11769) https://github.com/vim/vim/commit/dc4daa3a3915fba11ac87d27977240d9a5e0d47d Omit expand_autoload_callback(): only applies to Vim9 script. Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 7bae8dff00..8214a1c916 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1018,13 +1018,15 @@ void prepare_vimvar(int idx, typval_T *save_tv)
void restore_vimvar(int idx, typval_T *save_tv)
{
vimvars[idx].vv_tv = *save_tv;
- if (vimvars[idx].vv_type == VAR_UNKNOWN) {
- hashitem_T *hi = hash_find(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
- if (HASHITEM_EMPTY(hi)) {
- internal_error("restore_vimvar()");
- } else {
- hash_remove(&vimvarht, hi);
- }
+ if (vimvars[idx].vv_type != VAR_UNKNOWN) {
+ return;
+ }
+
+ hashitem_T *hi = hash_find(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
+ if (HASHITEM_EMPTY(hi)) {
+ internal_error("restore_vimvar()");
+ } else {
+ hash_remove(&vimvarht, hi);
}
}
@@ -6685,12 +6687,13 @@ void set_vim_var_dict(const VimVarIndex idx, dict_T *const val)
tv_clear(&vimvars[idx].vv_di.di_tv);
vimvars[idx].vv_type = VAR_DICT;
vimvars[idx].vv_dict = val;
-
- if (val != NULL) {
- val->dv_refcount++;
- // Set readonly
- tv_dict_set_keys_readonly(val);
+ if (val == NULL) {
+ return;
}
+
+ val->dv_refcount++;
+ // Set readonly
+ tv_dict_set_keys_readonly(val);
}
/// Set the v:argv list.