summaryrefslogtreecommitdiff
path: root/gcc/ada/g-dynhta.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-16 08:40:36 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-16 08:40:36 +0000
commita691a9d823d4df7462ece84f208187705f106dc4 (patch)
treecc921bbf3ca223a3cdfc91eece877b2fb384002c /gcc/ada/g-dynhta.adb
parent32918d54aa00cacf84b1c4a9ecec29cf2ec2ccdc (diff)
downloadgcc-a691a9d823d4df7462ece84f208187705f106dc4.tar.gz
2005-06-14 Pascal Obry <obry@adacore.com>
* g-dynhta.ads, g-dynhta.adb (Reset): Free the table itself after releasing the items. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-dynhta.adb')
-rw-r--r--gcc/ada/g-dynhta.adb14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/ada/g-dynhta.adb b/gcc/ada/g-dynhta.adb
index 5e95a9a56aa..677beafe693 100644
--- a/gcc/ada/g-dynhta.adb
+++ b/gcc/ada/g-dynhta.adb
@@ -1,12 +1,12 @@
------------------------------------------------------------------------------
-- --
--- GNAT RUNTIME COMPONENTS --
+-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . D Y N A M I C _ H T A B L E S --
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005 AdaCore --
-- --
-- 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- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
+
package body GNAT.Dynamic_HTables is
-------------------
@@ -179,6 +180,9 @@ package body GNAT.Dynamic_HTables is
-----------
procedure Reset (T : in out Instance) is
+ procedure Free is
+ new Ada.Unchecked_Deallocation (Instance_Data, Instance);
+
begin
if T = null then
return;
@@ -187,6 +191,8 @@ package body GNAT.Dynamic_HTables is
for J in T.Table'Range loop
T.Table (J) := Null_Ptr;
end loop;
+
+ Free (T);
end Reset;
---------
@@ -205,6 +211,7 @@ package body GNAT.Dynamic_HTables is
Set_Next (E, T.Table (Index));
T.Table (Index) := E;
end Set;
+
end Static_HTable;
-------------------
@@ -264,7 +271,6 @@ package body GNAT.Dynamic_HTables is
function Get_Next (T : Instance) return Element is
Tmp : constant Elmt_Ptr := Tab.Get_Next (Tab.Instance (T));
-
begin
if Tmp = null then
return No_Element;
@@ -322,7 +328,6 @@ package body GNAT.Dynamic_HTables is
procedure Set (T : in out Instance; K : Key; E : Element) is
Tmp : constant Elmt_Ptr := Tab.Get (Tab.Instance (T), K);
-
begin
if Tmp = null then
Tab.Set (Tab.Instance (T), new Element_Wrapper'(K, E, null));
@@ -339,6 +344,7 @@ package body GNAT.Dynamic_HTables is
begin
E.Next := Next;
end Set_Next;
+
end Simple_HTable;
end GNAT.Dynamic_HTables;