diff src/diff.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 6e24001000ed
children 50555279168b
line wrap: on
line diff
--- a/src/diff.c
+++ b/src/diff.c
@@ -559,14 +559,14 @@ diff_alloc_new(tabpage_T *tp, diff_T *dp
     diff_T	*dnew;
 
     dnew = ALLOC_ONE(diff_T);
-    if (dnew != NULL)
-    {
-	dnew->df_next = dp;
-	if (dprev == NULL)
-	    tp->tp_first_diff = dnew;
-	else
-	    dprev->df_next = dnew;
-    }
+    if (dnew == NULL)
+	return NULL;
+
+    dnew->df_next = dp;
+    if (dprev == NULL)
+	tp->tp_first_diff = dnew;
+    else
+	dprev->df_next = dnew;
     return dnew;
 }