diff src/edit.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 e94571ac4134
children 4545f58c8490
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -2970,12 +2970,12 @@ get_last_insert_save(void)
     if (last_insert == NULL)
 	return NULL;
     s = vim_strsave(last_insert + last_insert_skip);
-    if (s != NULL)
-    {
-	len = (int)STRLEN(s);
-	if (len > 0 && s[len - 1] == ESC)	// remove trailing ESC
-	    s[len - 1] = NUL;
-    }
+    if (s == NULL)
+	return NULL;
+
+    len = (int)STRLEN(s);
+    if (len > 0 && s[len - 1] == ESC)	// remove trailing ESC
+	s[len - 1] = NUL;
     return s;
 }