summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog15
-rw-r--r--libgfortran/gfortran.map4
-rw-r--r--libgfortran/intrinsics/move_alloc.c14
-rw-r--r--libgfortran/libgfortran.h5
-rw-r--r--libgfortran/runtime/error.c1
-rw-r--r--libgfortran/runtime/memory.c40
6 files changed, 29 insertions, 50 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index acfaec5e22f..a90c7160cd1 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,18 @@
+2007-05-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/30723
+ * runtime/memory.c (internal_malloc, internal_malloc64,
+ internal_free): Remove.
+ * runtime/error.c (os_error): Export function.
+ * intrinsics/move_alloc.c: Include stdlib.h.
+ (move_alloc): Call free instead of internal_free.
+ (move_alloc_c): Wrap long lines.
+ * libgfortran.h (os_error): Export prototype.
+ (internal_free): Remove prototype.
+ * gfortran.map (GFORTRAN_1.0): Remove _gfortran_internal_free,
+ _gfortran_internal_malloc and _gfortran_internal_malloc64.
+ Add _gfortran_os_error.
+
2007-05-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/31880
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index c1ca7255bb1..f67192db1d8 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -166,9 +166,6 @@ GFORTRAN_1.0 {
_gfortran_idate_i8;
_gfortran_ierrno_i4;
_gfortran_ierrno_i8;
- _gfortran_internal_free;
- _gfortran_internal_malloc;
- _gfortran_internal_malloc64;
_gfortran_internal_pack;
_gfortran_internal_realloc;
_gfortran_internal_realloc64;
@@ -502,6 +499,7 @@ GFORTRAN_1.0 {
_gfortran_nearest_r16;
_gfortran_nearest_r4;
_gfortran_nearest_r8;
+ _gfortran_os_error;
_gfortran_pack;
_gfortran_pack_char;
_gfortran_pack_s;
diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c
index b73ef4b77a0..24baf3971cd 100644
--- a/libgfortran/intrinsics/move_alloc.c
+++ b/libgfortran/intrinsics/move_alloc.c
@@ -28,8 +28,13 @@ License along with libgfortran; see the file COPYING. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
+#include "config.h"
#include "libgfortran.h"
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
extern void move_alloc (gfc_array_char *, gfc_array_char *);
export_proto(move_alloc);
@@ -38,7 +43,8 @@ move_alloc (gfc_array_char * from, gfc_array_char * to)
{
int i;
- internal_free (to->data);
+ if (to->data)
+ free (to->data);
for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++)
{
@@ -60,8 +66,10 @@ extern void move_alloc_c (gfc_array_char *, GFC_INTEGER_4,
export_proto(move_alloc_c);
void
-move_alloc_c (gfc_array_char * from, GFC_INTEGER_4 from_length __attribute__((unused)),
- gfc_array_char * to, GFC_INTEGER_4 to_length __attribute__((unused)))
+move_alloc_c (gfc_array_char * from,
+ GFC_INTEGER_4 from_length __attribute__((unused)),
+ gfc_array_char * to,
+ GFC_INTEGER_4 to_length __attribute__((unused)))
{
move_alloc (from, to);
}
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 0f7d2c7705a..fd510ee5fa1 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -583,7 +583,7 @@ extern const char *xtoa (GFC_UINTEGER_LARGEST, char *, size_t);
internal_proto(xtoa);
extern void os_error (const char *) __attribute__ ((noreturn));
-internal_proto(os_error);
+iexport_proto(os_error);
extern void show_locus (st_parameter_common *);
internal_proto(show_locus);
@@ -634,9 +634,6 @@ internal_proto(free_mem);
extern void *internal_malloc_size (size_t);
internal_proto(internal_malloc_size);
-extern void internal_free (void *);
-iexport_proto(internal_free);
-
/* environ.c */
extern int check_buffered (int);
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index 2bcc293091a..bd3c306bc2f 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -285,6 +285,7 @@ os_error (const char *message)
st_printf ("Operating system error: %s\n%s\n", get_oserror (), message);
sys_exit (1);
}
+iexport(os_error);
/* void runtime_error()-- These are errors associated with an
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index 58395303440..fe76675c9ad 100644
--- a/libgfortran/runtime/memory.c
+++ b/libgfortran/runtime/memory.c
@@ -77,46 +77,6 @@ internal_malloc_size (size_t size)
return get_mem (size);
}
-extern void *internal_malloc (GFC_INTEGER_4);
-export_proto(internal_malloc);
-
-void *
-internal_malloc (GFC_INTEGER_4 size)
-{
-#ifdef GFC_CHECK_MEMORY
- /* Under normal circumstances, this is _never_ going to happen! */
- if (size < 0)
- runtime_error ("Attempt to allocate a negative amount of memory.");
-
-#endif
- return internal_malloc_size ((size_t) size);
-}
-
-extern void *internal_malloc64 (GFC_INTEGER_8);
-export_proto(internal_malloc64);
-
-void *
-internal_malloc64 (GFC_INTEGER_8 size)
-{
-#ifdef GFC_CHECK_MEMORY
- /* Under normal circumstances, this is _never_ going to happen! */
- if (size < 0)
- runtime_error ("Attempt to allocate a negative amount of memory.");
-#endif
- return internal_malloc_size ((size_t) size);
-}
-
-
-/* Free internally allocated memory. Pointer is NULLified. Also used to
- free user allocated memory. */
-
-void
-internal_free (void *mem)
-{
- if (mem != NULL)
- free (mem);
-}
-iexport(internal_free);
/* Reallocate internal memory MEM so it has SIZE bytes of data.
Allocate a new block if MEM is zero, and free the block if