sort: remove 'rest' variable
This commit is contained in:
parent
56b9a26de9
commit
56e1616486
19
sort.c
19
sort.c
|
@ -211,26 +211,23 @@ skip_columns(char *s, size_t n)
|
||||||
static char *
|
static char *
|
||||||
columns(char *line, const struct keydef *kd)
|
columns(char *line, const struct keydef *kd)
|
||||||
{
|
{
|
||||||
char *rest;
|
|
||||||
char *start, *end;
|
char *start, *end;
|
||||||
char *res;
|
char *res;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
rest = skip_columns(line, kd->start_column);
|
start = skip_columns(line, kd->start_column);
|
||||||
for(i = 1; i < kd->start_char && *rest && !isblank(*rest); i++)
|
for(i = 1; i < kd->start_char && *start && !isblank(*start); i++)
|
||||||
rest++;
|
start++;
|
||||||
start = rest;
|
|
||||||
|
|
||||||
if(kd->end_column) {
|
if(kd->end_column) {
|
||||||
rest = 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 && *rest && !isblank(*rest); i++)
|
for(i = 1; i < kd->end_char && *end && !isblank(*end); i++)
|
||||||
rest++;
|
end++;
|
||||||
else
|
else
|
||||||
rest = next_blank(rest);
|
end = next_blank(end);
|
||||||
end = rest - 1;
|
|
||||||
} else {
|
} else {
|
||||||
end = rest + strlen(rest);
|
end = line + strlen(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((res = strndup(start, end - start)) == NULL)
|
if((res = strndup(start, end - start)) == NULL)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user