aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/sign.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-24 08:43:51 +0800
committerGitHub <noreply@github.com>2023-01-24 08:43:51 +0800
commitfa12b9ca2b1dd5515910875e04fe36564fbaadcc (patch)
treea9db5e808937b47883a341eabda44af00e0df878 /src/nvim/sign.c
parentdbb6c7f1b8bed789f5bebb73be332c063fc6a604 (diff)
downloadrneovim-fa12b9ca2b1dd5515910875e04fe36564fbaadcc.tar.gz
rneovim-fa12b9ca2b1dd5515910875e04fe36564fbaadcc.tar.bz2
rneovim-fa12b9ca2b1dd5515910875e04fe36564fbaadcc.zip
vim-patch:partial:9.0.1237: code is indented more than necessary (#21971)
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes vim/vim#11858) https://github.com/vim/vim/commit/6ec66660476562e643deceb7c325cd0e8c903663 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/sign.c')
-rw-r--r--src/nvim/sign.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index 753c814110..d0c093d93a 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -122,17 +122,17 @@ static signgroup_T *sign_group_ref(const char *groupname)
/// removed, then remove the group.
static void sign_group_unref(char *groupname)
{
- signgroup_T *group;
-
hashitem_T *hi = hash_find(&sg_table, groupname);
- if (!HASHITEM_EMPTY(hi)) {
- group = HI2SG(hi);
- group->sg_refcount--;
- if (group->sg_refcount == 0) {
- // All the signs in this group are removed
- hash_remove(&sg_table, hi);
- xfree(group);
- }
+ if (HASHITEM_EMPTY(hi)) {
+ return;
+ }
+
+ signgroup_T *group = HI2SG(hi);
+ group->sg_refcount--;
+ if (group->sg_refcount == 0) {
+ // All the signs in this group are removed
+ hash_remove(&sg_table, hi);
+ xfree(group);
}
}