diff options
author | Thomas Quinot <quinot@adacore.com> | 2007-08-14 10:46:03 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-08-14 10:46:03 +0200 |
commit | 1d6f10a19473c4c174bcb8295163be080ae6f64e (patch) | |
tree | e043ad5b7ca9b739ced688a5040d0ff234515f08 /gcc/ada/stringt.adb | |
parent | f97ccb3a84b27374661fd1f9540efb360d976019 (diff) | |
download | gcc-1d6f10a19473c4c174bcb8295163be080ae6f64e.zip gcc-1d6f10a19473c4c174bcb8295163be080ae6f64e.tar.gz gcc-1d6f10a19473c4c174bcb8295163be080ae6f64e.tar.bz2 |
table.adb, [...] (Append): Reimplement in terms of Set_Item.
2007-08-14 Thomas Quinot <quinot@adacore.com>
* table.adb, g-table.adb, g-dyntab.adb (Append): Reimplement in terms
of Set_Item.
(Set_Item): When the new item is an element of the currently allocated
table passed by reference, save a copy on the stack if we're going
to reallocate. Also, in Table.Set_Item, make sure we test the proper
variable to determine whether to call Set_Last.
* sinput-d.adb, sinput-l.adb, stringt.adb, switch-m.adb,
symbols-vms.adb, symbols-processing-vms-alpha.adb,
symbols-processing-vms-ia64.adb, sem_elab.adb, repinfo.adb: Replace
some occurrences of the pattern
T.Increment_Last;
T.Table (T.Last) := Value;
with a cleaner call to
T.Append (Value);
From-SVN: r127442
Diffstat (limited to 'gcc/ada/stringt.adb')
-rw-r--r-- | gcc/ada/stringt.adb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb index 1c03a88..e272009 100644 --- a/gcc/ada/stringt.adb +++ b/gcc/ada/stringt.adb @@ -139,9 +139,7 @@ package body Stringt is procedure Start_String is begin - Strings.Increment_Last; - Strings.Table (Strings.Last).String_Index := String_Chars.Last + 1; - Strings.Table (Strings.Last).Length := 0; + Strings.Append ((String_Index => String_Chars.Last + 1, Length => 0)); end Start_String; -- Version to start from initially stored string @@ -166,9 +164,8 @@ package body Stringt is String_Chars.Last + 1; for J in 1 .. Strings.Table (S).Length loop - String_Chars.Increment_Last; - String_Chars.Table (String_Chars.Last) := - String_Chars.Table (Strings.Table (S).String_Index + (J - 1)); + String_Chars.Append + (String_Chars.Table (Strings.Table (S).String_Index + (J - 1))); end loop; end if; @@ -183,8 +180,7 @@ package body Stringt is procedure Store_String_Char (C : Char_Code) is begin - String_Chars.Increment_Last; - String_Chars.Table (String_Chars.Last) := C; + String_Chars.Append (C); Strings.Table (Strings.Last).Length := Strings.Table (Strings.Last).Length + 1; end Store_String_Char; |