diff src/autocmd.c @ 31667:b89cfd86e18e v9.0.1166

patch 9.0.1166: code is indented more than necessary Commit: https://github.com/vim/vim/commit/1cfb14aa972ccf3235ac67f07b7db1175b7c5384 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Mon Jan 9 19:04:23 2023 +0000 patch 9.0.1166: code is indented more than necessary Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11792)
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Jan 2023 20:15:03 +0100
parents 742b7bf2fefc
children 2d96d7f9da7e
line wrap: on
line diff
--- a/src/autocmd.c
+++ b/src/autocmd.c
@@ -1063,18 +1063,18 @@ au_get_grouparg(char_u **argp)
 
     for (p = arg; *p && !VIM_ISWHITE(*p) && *p != '|'; ++p)
 	;
-    if (p > arg)
-    {
-	group_name = vim_strnsave(arg, p - arg);
-	if (group_name == NULL)		// out of memory
-	    return AUGROUP_ERROR;
-	group = au_find_group(group_name);
-	if (group == AUGROUP_ERROR)
-	    group = AUGROUP_ALL;	// no match, use all groups
-	else
-	    *argp = skipwhite(p);	// match, skip over group name
-	vim_free(group_name);
-    }
+    if (p <= arg)
+	return AUGROUP_ALL;
+
+    group_name = vim_strnsave(arg, p - arg);
+    if (group_name == NULL)		// out of memory
+	return AUGROUP_ERROR;
+    group = au_find_group(group_name);
+    if (group == AUGROUP_ERROR)
+	group = AUGROUP_ALL;	// no match, use all groups
+    else
+	*argp = skipwhite(p);	// match, skip over group name
+    vim_free(group_name);
     return group;
 }