OSDN Git Service

2005-03-29 Ed Falis <falis@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-memory.adb
index cdbb22e..6e995f4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2003 Free Software Foundation, Inc.          --
+--          Copyright (C) 2001-2005 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- --
 
 --  This implementation assumes that the underlying malloc/free/realloc
 --  implementation is thread safe, and thus, no additional lock is required.
---  Note that we still need to defer abortion because on most systems,
---  an asynchronous signal (as used for implementing asynchronous abortion
---  of task) cannot safely be handled while malloc is executing.
+--  Note that we still need to defer abort because on most systems, an
+--  asynchronous signal (as used for implementing asynchronous abort of
+--  task) cannot safely be handled while malloc is executing.
 
---  If you are not using Ada constructs containing the "abort" keyword,
---  then you can remove the calls to Abort_Defer.all and Abort_Undefer.all
---  from this unit.
+--  If you are not using Ada constructs containing the "abort" keyword, then
+--  you can remove the calls to Abort_Defer.all and Abort_Undefer.all from
+--  this unit.
 
 with Ada.Exceptions;
 with System.Soft_Links;
 with System.Parameters;
+with System.CRTL;
 
 package body System.Memory is
 
    use Ada.Exceptions;
    use System.Soft_Links;
 
-   function c_malloc (Size : size_t) return System.Address;
-   pragma Import (C, c_malloc, "malloc");
+   function c_malloc (Size : System.CRTL.size_t) return System.Address
+    renames System.CRTL.malloc;
 
-   procedure c_free (Ptr : System.Address);
-   pragma Import (C, c_free, "free");
+   procedure c_free (Ptr : System.Address)
+     renames System.CRTL.free;
 
    function c_realloc
-     (Ptr : System.Address; Size : size_t) return System.Address;
-   pragma Import (C, c_realloc, "realloc");
+     (Ptr : System.Address; Size : System.CRTL.size_t) return System.Address
+     renames System.CRTL.realloc;
 
    -----------
    -- Alloc --
@@ -85,10 +86,10 @@ package body System.Memory is
       end if;
 
       if Parameters.No_Abort then
-         Result := c_malloc (Actual_Size);
+         Result := c_malloc (System.CRTL.size_t (Actual_Size));
       else
          Abort_Defer.all;
-         Result := c_malloc (Actual_Size);
+         Result := c_malloc (System.CRTL.size_t (Actual_Size));
          Abort_Undefer.all;
       end if;
 
@@ -132,10 +133,10 @@ package body System.Memory is
       end if;
 
       if Parameters.No_Abort then
-         Result := c_realloc (Ptr, Actual_Size);
+         Result := c_realloc (Ptr, System.CRTL.size_t (Actual_Size));
       else
          Abort_Defer.all;
-         Result := c_realloc (Ptr, Actual_Size);
+         Result := c_realloc (Ptr, System.CRTL.size_t (Actual_Size));
          Abort_Undefer.all;
       end if;