sort: replace loop with MIN()
This commit is contained in:
parent
56e1616486
commit
e535e8d88a
7
sort.c
7
sort.c
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user