diff mbox series

[3/4] xdiff/xmerge: simplify xdl_recs_copy_0

Message ID 20210613225836.1009569-4-felipe.contreras@gmail.com (mailing list archive)
State New
Headers show
Series merge: cleanups and fix | expand

Commit Message

Felipe Contreras June 13, 2021, 10:58 p.m. UTC
Remove one unnecessary indentation level.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 xdiff/xmerge.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index ab3448ca88..b5b3f56f92 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -122,19 +122,19 @@  static int xdl_recs_copy_0(int use_orig, xdfenv_t *xe, int i, int count, int nee
 	for (i = 0; i < count; size += recs[i++]->size)
 		if (dest)
 			memcpy(dest + size, recs[i]->ptr, recs[i]->size);
-	if (add_nl) {
-		i = recs[count - 1]->size;
-		if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
-			if (needs_cr) {
-				if (dest)
-					dest[size] = '\r';
-				size++;
-			}
-
+	if (!add_nl)
+		return size;
+	i = recs[count - 1]->size;
+	if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
+		if (needs_cr) {
 			if (dest)
-				dest[size] = '\n';
+				dest[size] = '\r';
 			size++;
 		}
+
+		if (dest)
+			dest[size] = '\n';
+		size++;
 	}
 	return size;
 }