sed: code shrink

function                                             old     new   delta
process_files                                       2181    2173      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/editors/sed.c b/editors/sed.c
index 87fc755..85c8466 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -737,6 +737,8 @@
 
 	/* Now loop through, substituting for matches */
 	do {
+		int start = G.regmatch[0].rm_so;
+		int end = G.regmatch[0].rm_eo;
 		int i;
 
 		match_count++;
@@ -746,16 +748,16 @@
 		if (sed_cmd->which_match
 		 && (sed_cmd->which_match != match_count)
 		) {
-			for (i = 0; i < G.regmatch[0].rm_eo; i++)
+			for (i = 0; i < end; i++)
 				pipe_putc(*line++);
 			/* Null match? Print one more char */
-			if (G.regmatch[0].rm_so == i && *line)
+			if (start == end && *line)
 				pipe_putc(*line++);
 			goto next;
 		}
 
 		/* Print everything before the match */
-		for (i = 0; i < G.regmatch[0].rm_so; i++)
+		for (i = 0; i < start; i++)
 			pipe_putc(line[i]);
 
 		/* Then print the substitution string,
@@ -765,25 +767,25 @@
 		 * second is "" before "d", third is "" after "d".
 		 * Second match is NOT replaced!
 		 */
-		if (prev_match_empty || i != 0) {
-			dbg("inserting replacement at %d in '%s'", i, line);
+		if (prev_match_empty || start != 0) {
+			dbg("inserting replacement at %d in '%s'", start, line);
 			do_subst_w_backrefs(line, sed_cmd->string);
 		} else {
-			dbg("NOT inserting replacement at %d in '%s'", i, line);
+			dbg("NOT inserting replacement at %d in '%s'", start, line);
 		}
 
 		/* If matched string is empty (f.e. "c*" pattern),
 		 * copy verbatim one char after it before attempting more matches
 		 */
-		prev_match_empty = (G.regmatch[0].rm_eo == i);
-		if (prev_match_empty && line[i]) {
-			pipe_putc(line[i]);
-			G.regmatch[0].rm_eo++;
+		prev_match_empty = (start == end);
+		if (prev_match_empty && line[end]) {
+			pipe_putc(line[end]);
+			end++;
 		}
 
 		/* Advance past the match */
-		dbg("line += %d", G.regmatch[0].rm_eo);
-		line += G.regmatch[0].rm_eo;
+		dbg("line += %d", end);
+		line += end;
 		/* Flag that something has changed */
 		altered = 1;
 
@@ -798,7 +800,7 @@
 			tried_at_eol = 1;
 		}
 
-//maybe (G.regmatch[0].rm_eo ? REG_NOTBOL : 0) instead of unconditional REG_NOTBOL?
+//maybe (end ? REG_NOTBOL : 0) instead of unconditional REG_NOTBOL?
 	} while (regexec(current_regex, line, 10, G.regmatch, REG_NOTBOL) != REG_NOMATCH);
 
 	/* Copy rest of string into output pipeline */