diff options
Diffstat (limited to 'gcc/ada/a-cohama.adb')
-rw-r--r-- | gcc/ada/a-cohama.adb | 90 |
1 files changed, 85 insertions, 5 deletions
diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb index 8adcb1a..00553d0 100644 --- a/gcc/ada/a-cohama.adb +++ b/gcc/ada/a-cohama.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2012, 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- -- @@ -135,6 +135,20 @@ package body Ada.Containers.Hashed_Maps is HT_Ops.Adjust (Container.HT); end Adjust; + procedure Adjust (Control : in out Reference_Control_Type) is + begin + if Control.Container /= null then + declare + HT : Hash_Table_Type renames Control.Container.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + B := B + 1; + L := L + 1; + end; + end if; + end Adjust; + ------------ -- Assign -- ------------ @@ -211,7 +225,19 @@ package body Ada.Containers.Hashed_Maps is (Vet (Position), "Position cursor in Constant_Reference is bad"); - return (Element => Position.Node.Element'Access); + declare + HT : Hash_Table_Type renames Container'Unrestricted_Access.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + return R : constant Constant_Reference_Type := + (Element => Position.Node.Element'Access, + Control => (Controlled with Position.Container)) + do + B := B + 1; + L := L + 1; + end return; + end; end Constant_Reference; function Constant_Reference @@ -225,7 +251,20 @@ package body Ada.Containers.Hashed_Maps is raise Constraint_Error with "key not in map"; end if; - return (Element => Node.Element'Access); + declare + HT : Hash_Table_Type renames Container'Unrestricted_Access.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + return R : constant Constant_Reference_Type := + (Element => Node.Element'Access, + Control => + (Controlled with Container'Unrestricted_Access)) + do + B := B + 1; + L := L + 1; + end return; + end; end Constant_Reference; -------------- @@ -439,6 +478,22 @@ package body Ada.Containers.Hashed_Maps is end if; end Finalize; + procedure Finalize (Control : in out Reference_Control_Type) is + begin + if Control.Container /= null then + declare + HT : Hash_Table_Type renames Control.Container.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + B := B - 1; + L := L - 1; + end; + + Control.Container := null; + end if; + end Finalize; + ---------- -- Find -- ---------- @@ -920,7 +975,19 @@ package body Ada.Containers.Hashed_Maps is (Vet (Position), "Position cursor in function Reference is bad"); - return (Element => Position.Node.Element'Access); + declare + HT : Hash_Table_Type renames Container'Unrestricted_Access.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + return R : constant Reference_Type := + (Element => Position.Node.Element'Access, + Control => (Controlled with Position.Container)) + do + B := B + 1; + L := L + 1; + end return; + end; end Reference; function Reference @@ -934,7 +1001,20 @@ package body Ada.Containers.Hashed_Maps is raise Constraint_Error with "key not in map"; end if; - return (Element => Node.Element'Access); + declare + HT : Hash_Table_Type renames Container'Unrestricted_Access.all.HT; + B : Natural renames HT.Busy; + L : Natural renames HT.Lock; + begin + return R : constant Reference_Type := + (Element => Node.Element'Access, + Control => + (Controlled with Container'Unrestricted_Access)) + do + B := B + 1; + L := L + 1; + end return; + end; end Reference; --------------- |