From ac8eb42a4f8bf3171000efa4acdd47cb2b0280fe Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 12 Sep 2017 20:46:14 +0200
Subject: [PATCH] tweaks: elide a superfluous allocation

---
 src/text.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/text.c b/src/text.c
index 61e84e93..b302163c 100644
--- a/src/text.c
+++ b/src/text.c
@@ -461,18 +461,16 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
 
 	/* For each line in the group, add or remove the individual indent. */
 	while (line && line->lineno <= group->bottom_line) {
-	    char *indentation = mallocstrcpy(NULL,
-			group->indentations[line->lineno - group->top_line]);
+	    char *blanks = group->indentations[line->lineno - group->top_line];
 
 	    if (undoing ^ add_indent)
-		indent_a_line(line, indentation);
+		indent_a_line(line, blanks);
 	    else
-		unindent_a_line(line, strlen(indentation));
-
-	    free(indentation);
+		unindent_a_line(line, strlen(blanks));
 
 	    line = line->next;
 	}
+
 	group = group->next;
     }
 
@@ -652,6 +650,7 @@ void handle_comment_action(undo *u, bool undoing, bool add_comment)
 				COMMENT : UNCOMMENT, f, u->strdata);
 	    f = f->next;
 	}
+
 	group = group->next;
     }
 
-- 
GitLab