summaryrefslogtreecommitdiff
path: root/gcc/ada/a-swunau.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2005-03-15 16:53:10 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2005-03-15 16:53:10 +0100
commit2f388d2db6113fc8113d983c7370b7c45b1024ab (patch)
tree5ce32e503ea5e4af6010553a51d8e39be3fbf801 /gcc/ada/a-swunau.adb
parent798a90555d7d72881c3d81d773328dc4156b4e6e (diff)
downloadgcc-2f388d2db6113fc8113d983c7370b7c45b1024ab.tar.gz
re PR ada/13470 (64bits Ada bootstrap failure:xnmake etc. crash generating nmake.adb etc.)
2005-03-08 Robert Dewar <dewar@adacore.com> PR ada/13470 * a-stunau.ads, a-stunau.adb: Change interface to allow efficient (and correct) implementation The previous changes to allow extra space in unbounded strings had left this interface a bit broken. * a-suteio.adb: Avoid unnecessary use of Get/Set_String * g-spipat.ads, g-spipat.adb: New interface for Get_String Minor reformatting (function specs) * g-spitbo.adb: New interface for Get_String * g-spitbo.ads: Minor reformatting * a-swunau.ads, a-swunau.adb: New interface for Get_Wide_String * a-szunau.ads, a-szunau.adb: New interface for Get_Wide_Wide_String From-SVN: r96488
Diffstat (limited to 'gcc/ada/a-swunau.adb')
-rw-r--r--gcc/ada/a-swunau.adb50
1 files changed, 12 insertions, 38 deletions
diff --git a/gcc/ada/a-swunau.adb b/gcc/ada/a-swunau.adb
index 2d9a2dd0b1c..2f4c127b71b 100644
--- a/gcc/ada/a-swunau.adb
+++ b/gcc/ada/a-swunau.adb
@@ -37,33 +37,14 @@ package body Ada.Strings.Wide_Unbounded.Aux is
-- Get_Wide_String --
---------------------
- function Get_Wide_String
- (U : Unbounded_Wide_String) return Wide_String_Access
+ procedure Get_Wide_String
+ (U : Unbounded_Wide_String;
+ S : out Wide_String_Access;
+ L : out Natural)
is
begin
- if U.Last = U.Reference'Length then
- return U.Reference;
-
- else
- declare
- type Unbounded_Wide_String_Access is
- access all Unbounded_Wide_String;
-
- U_Ptr : constant Unbounded_Wide_String_Access :=
- U'Unrestricted_Access;
- -- Unbounded_Wide_String is a controlled type which is always
- -- passed by copy it is always safe to take the pointer to such
- -- object here. This pointer is used to set the U.Reference value
- -- which would not be possible otherwise as U is read-only.
-
- Old : Wide_String_Access := U.Reference;
-
- begin
- U_Ptr.Reference := new Wide_String'(U.Reference (1 .. U.Last));
- Free (Old);
- return U.Reference;
- end;
- end if;
+ S := U.Reference;
+ L := U.Last;
end Get_Wide_String;
---------------------
@@ -75,20 +56,13 @@ package body Ada.Strings.Wide_Unbounded.Aux is
S : Wide_String)
is
begin
- if UP.Last = S'Length then
- UP.Reference.all := S;
-
- else
- declare
- subtype String_1 is Wide_String (1 .. S'Length);
- Tmp : Wide_String_Access;
- begin
- Tmp := new Wide_String'(String_1 (S));
- Finalize (UP);
- UP.Reference := Tmp;
- UP.Last := UP.Reference'Length;
- end;
+ if S'Length > UP.Last then
+ Finalize (UP);
+ UP.Reference := new Wide_String (1 .. S'Length);
end if;
+
+ UP.Reference (1 .. S'Length) := S;
+ UP.Last := S'Length;
end Set_Wide_String;
procedure Set_Wide_String