[PATCH 3/8] sort: remove 'rest' variable

From: Jakob Kramer <jakob.kramer_AT_gmx.de>
Date: Sat, 3 May 2014 18:44:10 +0200

---
 sort.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/sort.c b/sort.c
index be1f699..deab422 100644
--- a/sort.c
+++ b/sort.c
_AT_@ -211,26 +211,23 @@ skip_columns(char *s, size_t n)
 static char *
 columns(char *line, const struct keydef *kd)
 {
-	char *rest;
 	char *start, *end;
 	char *res;
 	unsigned int i;
 
-	rest = skip_columns(line, kd->start_column);
-	for(i = 1; i < kd->start_char && *rest && !isblank(*rest); i++)
-		rest++;
-	start = rest;
+	start = skip_columns(line, kd->start_column);
+	for(i = 1; i < kd->start_char && *start && !isblank(*start); i++)
+		start++;
 
 	if(kd->end_column) {
-		rest = skip_columns(line, kd->end_column);
+		end = skip_columns(line, kd->end_column);
 		if(kd->end_char)
-			for(i = 1; i < kd->end_char && *rest && !isblank(*rest); i++)
-				rest++;
+			for(i = 1; i < kd->end_char && *end && !isblank(*end); i++)
+				end++;
 		else
-			rest = next_blank(rest);
-		end = rest - 1;
+			end = next_blank(end);
 	} else {
-		end = rest + strlen(rest);
+		end = line + strlen(line);
 	}
 
 	if((res = strndup(start, end - start)) == NULL)
-- 
1.8.5.1
--/04w6evG8XlLl3ft
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0004-sort-replace-loop-with-MIN.patch"
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Sat May 03 2014 - 21:48:03 CEST