diff options
author | mikeymell <mikeymell@users.noreply.github.com> | 2018-07-24 17:20:31 +0300 |
---|---|---|
committer | mikeymell <mikeymell@users.noreply.github.com> | 2018-07-24 17:35:24 +0300 |
commit | 98d3908a6a5f3c9cff390e51db1657ff47a5b267 (patch) | |
tree | 6bdf4851fe1e2a5629789fc2c2a963889198181c /src/vmtbl.c | |
parent | 60eb68aadbcccf823f2efda78d800c6d472b8f35 (diff) |
Grow table up to MAXROWS exactly
Diffstat (limited to 'src/vmtbl.c')
-rw-r--r-- | src/vmtbl.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/vmtbl.c b/src/vmtbl.c index 3032364..47c248f 100644 --- a/src/vmtbl.c +++ b/src/vmtbl.c @@ -160,10 +160,20 @@ int growtbl(int rowcol, int toprow, int topcol) { #ifndef PSC /* set how much to grow */ if ((rowcol == GROWROW) || (rowcol == GROWBOTH)) { + if ((maxcols == MAXROWS) || (toprow >= MAXROWS)) { + sc_error(nolonger); + return (FALSE); + } + if (toprow > maxrows) newrows = GROWAMT + toprow; else newrows += GROWAMT; + + /* If we're close but less than MAXROWS, clip to max value */ + if ( newrows > MAXROWS ) + newrows = MAXROWS; + } #endif /* !PSC */ if ((rowcol == GROWCOL) || (rowcol == GROWBOTH)) { @@ -181,11 +191,6 @@ int growtbl(int rowcol, int toprow, int topcol) { newcols = ABSMAXCOLS; } - if (newrows > MAXROWS) { // 08/12/2014 - sc_error(nolonger); - return (FALSE); - } - #ifndef PSC if ((rowcol == GROWROW) || (rowcol == GROWBOTH) || (rowcol == GROWNEW)) { struct ent *** lnullit; |