This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] relocate realloc()
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch] relocate realloc()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 19 Mar 2001 20:11:11 -0500
FYI,
I've checked in the attatched. It zaps a few stray non xrealloc() calls
and moves the realloc() decl to utils.c.
Andrew
2001-03-19 Andrew Cagney <ac131313@redhat.com>
* defs.h (realloc): Move declaration from here.
* utils.c (realloc): To here.
* config/pa/xm-hppah.h (realloc): Delete declaration.
* lin-thread.c (insert_thread): Use xrealloc instead of realloc.
* symfile.c (add_filename_language): Ditto.
* event-loop.c (create_file_handler): Ditto.
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.44
diff -p -r1.44 defs.h
*** defs.h 2001/03/20 00:28:23 1.44
--- defs.h 2001/03/20 00:40:28
*************** extern double atof (const char *); /* X3
*** 951,960 ****
extern PTR malloc ();
#endif
- #ifdef NEED_DECLARATION_REALLOC
- extern PTR realloc ();
- #endif
-
#endif /* MALLOC_INCOMPATIBLE */
/* Various possibilities for alloca. */
--- 951,956 ----
Index: event-loop.c
===================================================================
RCS file: /cvs/src/src/gdb/event-loop.c,v
retrieving revision 1.13
diff -p -r1.13 event-loop.c
*** event-loop.c 2001/03/07 02:57:08 1.13
--- event-loop.c 2001/03/20 00:40:29
*************** create_file_handler (int fd, int mask, h
*** 544,551 ****
gdb_notifier.num_fds++;
if (gdb_notifier.poll_fds)
gdb_notifier.poll_fds =
! (struct pollfd *) realloc (gdb_notifier.poll_fds,
! (gdb_notifier.num_fds) * sizeof (struct pollfd));
else
gdb_notifier.poll_fds =
(struct pollfd *) xmalloc (sizeof (struct pollfd));
--- 544,552 ----
gdb_notifier.num_fds++;
if (gdb_notifier.poll_fds)
gdb_notifier.poll_fds =
! (struct pollfd *) xrealloc (gdb_notifier.poll_fds,
! (gdb_notifier.num_fds
! * sizeof (struct pollfd)));
else
gdb_notifier.poll_fds =
(struct pollfd *) xmalloc (sizeof (struct pollfd));
Index: lin-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/lin-thread.c,v
retrieving revision 1.12
diff -p -r1.12 lin-thread.c
*** lin-thread.c 2001/03/15 16:55:14 1.12
--- lin-thread.c 2001/03/20 00:40:31
*************** insert_thread (int tid, int lid, td_thr_
*** 780,787 ****
if (threadlist_top >= threadlist_max)
{
threadlist_max += THREADLIST_ALLOC;
! threadlist = realloc (threadlist,
! threadlist_max * sizeof (threadinfo));
if (threadlist == NULL)
return NULL;
}
--- 780,787 ----
if (threadlist_top >= threadlist_max)
{
threadlist_max += THREADLIST_ALLOC;
! threadlist = xrealloc (threadlist,
! threadlist_max * sizeof (threadinfo));
if (threadlist == NULL)
return NULL;
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.28
diff -p -r1.28 symfile.c
*** symfile.c 2001/03/07 02:57:08 1.28
--- symfile.c 2001/03/20 00:40:36
*************** add_filename_language (char *ext, enum l
*** 1782,1789 ****
if (fl_table_next >= fl_table_size)
{
fl_table_size += 10;
! filename_language_table = realloc (filename_language_table,
! fl_table_size);
}
filename_language_table[fl_table_next].ext = xstrdup (ext);
--- 1782,1789 ----
if (fl_table_next >= fl_table_size)
{
fl_table_size += 10;
! filename_language_table = xrealloc (filename_language_table,
! fl_table_size);
}
filename_language_table[fl_table_next].ext = xstrdup (ext);
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.36
diff -p -r1.36 utils.c
*** utils.c 2001/03/20 00:28:23 1.36
--- utils.c 2001/03/20 00:40:38
***************
*** 57,62 ****
--- 57,65 ----
#include <readline/readline.h>
#ifndef MALLOC_INCOMPATIBLE
+ #ifdef NEED_DECLARATION_REALLOC
+ extern PTR realloc ();
+ #endif
#ifdef NEED_DECLARATION_FREE
extern void free ();
#endif
Index: config/pa/xm-hppah.h
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/xm-hppah.h,v
retrieving revision 1.4
diff -p -r1.4 xm-hppah.h
*** xm-hppah.h 2001/03/20 00:28:23 1.4
--- xm-hppah.h 2001/03/20 00:40:39
***************
*** 42,46 ****
#define MALLOC_INCOMPATIBLE
extern void *malloc (size_t);
-
- extern void *realloc (void *, size_t);
--- 42,44 ----