optimise prefer_cols print_columns display

This commit is contained in:
tg
2013-02-24 14:22:44 +00:00
parent 9a8cb6fbf6
commit d7c28d90f9
3 changed files with 9 additions and 10 deletions

9
misc.c
View File

@ -3,7 +3,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012
* 2011, 2012, 2013
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.206 2013/02/24 14:10:04 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.207 2013/02/24 14:22:43 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -1213,9 +1213,8 @@ print_columns(struct shf *shf, unsigned int n,
rows = (n + cols - 1) / cols;
if (prefcol && cols > rows) {
i = rows;
rows = cols > n ? n : cols;
cols = i;
cols = rows;
rows = (n + cols - 1) / cols;
}
max_col = -max_col;