diff options
author | Robert Dewar <dewar@adacore.com> | 2006-10-31 18:51:38 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2006-10-31 18:51:38 +0100 |
commit | cce685621b46adb534ec20fcf9a76606596288be (patch) | |
tree | 82f467f6771df85b9ce495a5af4527dc1f9635c0 /gcc/ada/table.adb | |
parent | c064e066027cb688449ce4e3fd28126fe45b0e11 (diff) | |
download | gcc-cce685621b46adb534ec20fcf9a76606596288be.tar.gz |
clean.adb, [...]: Fix bad table increment values (much too small)
2006-10-31 Robert Dewar <dewar@adacore.com>
* clean.adb, gnatname.adb, gnatsym.adb, prep.adb, prep.ads,
prepcomp.adb, prj.ads, prj-strt.adb, sem_maps.ads,
vms_conv.adb: Fix bad table increment values (much too small)
* table.adb (Realloc): Make sure we get at least some new elements
Defends against silly small values for table increment
From-SVN: r118249
Diffstat (limited to 'gcc/ada/table.adb')
-rw-r--r-- | gcc/ada/table.adb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb index b99e6254e9d..7897378a1d0 100644 --- a/gcc/ada/table.adb +++ b/gcc/ada/table.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2004 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -163,7 +163,7 @@ package body Table is ---------------- procedure Reallocate is - New_Size : Memory.size_t; + New_Size : Memory.size_t; begin if Max < Last_Val then @@ -174,10 +174,15 @@ package body Table is Length := Int'Max (Length, Table_Initial); - -- Now increment table length until it is sufficiently large + -- Now increment table length until it is sufficiently large. Use + -- the increment value or 10, which ever is larger (the reason + -- for the use of 10 here is to ensure that the table does really + -- increase in size (which would not be the case for a table of + -- length 10 increased by 3% for instance). while Max < Last_Val loop - Length := Length * (100 + Table_Increment) / 100; + Length := Int'Max (Length * (100 + Table_Increment) / 100, + Length + 10); Max := Min + Length - 1; end loop; |