sort: replace loop with MIN()

This commit is contained in:
Jakob Kramer 2014-05-03 18:52:18 +02:00 committed by sin
parent 56e1616486
commit e535e8d88a

7
sort.c
View File

@ -213,17 +213,14 @@ columns(char *line, const struct keydef *kd)
{ {
char *start, *end; char *start, *end;
char *res; char *res;
unsigned int i;
start = skip_columns(line, kd->start_column); start = skip_columns(line, kd->start_column);
for(i = 1; i < kd->start_char && *start && !isblank(*start); i++) start += MIN(kd->start_char, next_blank(start) - start) - 1;
start++;
if(kd->end_column) { if(kd->end_column) {
end = skip_columns(line, kd->end_column); end = skip_columns(line, kd->end_column);
if(kd->end_char) if(kd->end_char)
for(i = 1; i < kd->end_char && *end && !isblank(*end); i++) end += MIN(kd->end_char, next_blank(end) - end);
end++;
else else
end = next_blank(end); end = next_blank(end);
} else { } else {