sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit e535e8d88a12459ddbf3542af6483b242cbd09e0
parent 56e1616486154d0d15fe04567a16328b2a94d51a
Author: Jakob Kramer <jakob.kramer@gmx.de>
Date:   Sat,  3 May 2014 18:52:18 +0200

sort: replace loop with MIN()

Diffstat:
Msort.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

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