OSDN Git Service

* doc/install.texi (Specific, mips-sgi-irix5): Document IRIX 5
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-dynhta.adb
index 5e95a9a..e423bab 100644 (file)
@@ -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-2006, 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- --
@@ -16,8 +16,8 @@
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- As a special exception,  if other files  instantiate  generics from this --
 -- unit, or you link  this unit with other files  to produce an executable, --
@@ -31,7 +31,6 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Ada.Unchecked_Deallocation;
 package body GNAT.Dynamic_HTables is
 
    -------------------
@@ -179,6 +178,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 +189,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 +209,7 @@ package body GNAT.Dynamic_HTables is
          Set_Next (E, T.Table (Index));
          T.Table (Index) := E;
       end Set;
+
    end Static_HTable;
 
    -------------------
@@ -264,7 +269,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 +326,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 +342,7 @@ package body GNAT.Dynamic_HTables is
       begin
          E.Next := Next;
       end Set_Next;
+
    end Simple_HTable;
 
 end GNAT.Dynamic_HTables;