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

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.598 2013/02/23 20:03:27 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.599 2013/02/24 14:22:41 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD # http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R44 2013/02/23 @(#)MIRBSD KSH R44 2013/02/24
description: description:
Check version of shell. Check version of shell.
stdin: stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no category: shell:legacy-no
--- ---
expected-stdout: expected-stdout:
@(#)LEGACY KSH R44 2013/02/23 @(#)LEGACY KSH R44 2013/02/24
description: description:
Check version of legacy shell. Check version of legacy shell.
stdin: stdin:

9
misc.c
View File

@ -3,7 +3,7 @@
/*- /*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012 * 2011, 2012, 2013
* Thorsten Glaser <tg@mirbsd.org> * Thorsten Glaser <tg@mirbsd.org>
* *
* Provided that these terms and disclaimer and all copyright notices * Provided that these terms and disclaimer and all copyright notices
@ -30,7 +30,7 @@
#include <grp.h> #include <grp.h>
#endif #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 #define KSH_CHVT_FLAG
#ifdef MKSH_SMALL #ifdef MKSH_SMALL
@ -1213,9 +1213,8 @@ print_columns(struct shf *shf, unsigned int n,
rows = (n + cols - 1) / cols; rows = (n + cols - 1) / cols;
if (prefcol && cols > rows) { if (prefcol && cols > rows) {
i = rows; cols = rows;
rows = cols > n ? n : cols; rows = (n + cols - 1) / cols;
cols = i;
} }
max_col = -max_col; max_col = -max_col;

4
sh.h
View File

@ -164,9 +164,9 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.640 2013/02/23 20:03:31 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.641 2013/02/24 14:22:44 tg Exp $");
#endif #endif
#define MKSH_VERSION "R44 2013/02/23" #define MKSH_VERSION "R44 2013/02/24"
/* arithmetic types: C implementation */ /* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES #if !HAVE_CAN_INTTYPES