aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-08 16:32:40 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-08 16:32:40 +0000
commit092abcdfba2315513cd8277751c5964db3e235b6 (patch)
treef5ac2cc4a33886e0b2cd07d40e77e4ad02acdc61
parent549cd3bac1252695a33a3900c3780ef86c1ddea2 (diff)
downloadgdb-092abcdfba2315513cd8277751c5964db3e235b6.zip
gdb-092abcdfba2315513cd8277751c5964db3e235b6.tar.gz
gdb-092abcdfba2315513cd8277751c5964db3e235b6.tar.bz2
* libbfd.c (bfd_get_file_window): Change return type to boolean.
Cast realloc and malloc return values. If malloc or realloc fail, set bfd_error_no_memory. * bfd-in.h (bfd_get_file_window): Change type to boolean. * bfd-in2.h: Rebuild.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/bfd-in.h7
-rw-r--r--bfd/bfd-in2.h7
-rw-r--r--bfd/libbfd.c15
4 files changed, 26 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b5666c1..ada9f55 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+Wed Nov 8 11:31:11 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * libbfd.c (bfd_get_file_window): Change return type to boolean.
+ Cast realloc and malloc return values. If malloc or realloc fail,
+ set bfd_error_no_memory.
+ * bfd-in.h (bfd_get_file_window): Change type to boolean.
+ * bfd-in2.h: Rebuild.
+
Tue Nov 7 11:53:48 1995 Kim Knuttila <krk@cygnus.com>
* coff-ppc.c (ppc_record_toc_entry): new function.
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index d69f763..303ce02 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -618,9 +618,10 @@ typedef struct _bfd_window {
struct _bfd_window_internal *i;
} bfd_window;
-void bfd_init_window PARAMS ((bfd_window *));
-void bfd_free_window PARAMS ((bfd_window *));
-int bfd_get_file_window PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
+extern void bfd_init_window PARAMS ((bfd_window *));
+extern void bfd_free_window PARAMS ((bfd_window *));
+extern boolean bfd_get_file_window
+ PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
/* XCOFF support routines for the linker. */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 394979d..54a7c0c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -618,9 +618,10 @@ typedef struct _bfd_window {
struct _bfd_window_internal *i;
} bfd_window;
-void bfd_init_window PARAMS ((bfd_window *));
-void bfd_free_window PARAMS ((bfd_window *));
-int bfd_get_file_window PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
+extern void bfd_init_window PARAMS ((bfd_window *));
+extern void bfd_free_window PARAMS ((bfd_window *));
+extern boolean bfd_get_file_window
+ PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
/* XCOFF support routines for the linker. */
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 5f682ec..291b1fd 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -302,7 +302,7 @@ bfd_free_window (windowp)
static int ok_to_map = 1;
-int
+boolean
bfd_get_file_window (abfd, offset, size, windowp, writable)
bfd *abfd;
file_ptr offset;
@@ -412,14 +412,19 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
fprintf (stderr, "\n\t%s(%6ld)",
i->data ? "realloc" : " malloc", (long) size_to_alloc);
if (i->data)
- i->data = realloc (i->data, size_to_alloc);
+ i->data = (PTR) realloc (i->data, size_to_alloc);
else
- i->data = malloc (size_to_alloc);
+ i->data = (PTR) malloc (size_to_alloc);
if (debug_windows)
fprintf (stderr, "\t-> %p\n", i->data);
i->refcount = 1;
- if (i->data == 0)
- return size_to_alloc == 0;
+ if (i->data == NULL)
+ {
+ if (size_to_alloc == 0)
+ return true;
+ bfd_set_error (bfd_error_no_memory);
+ return false;
+ }
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
return false;
i->size = bfd_read (i->data, size, 1, abfd);