From 982526a134330b9524daea65f26ba2cfe36cb275 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 30 Sep 2004 19:57:54 +0000 Subject: [PATCH] * defs.h (msavestring, mstrsave): Remove prototypes. * utils.c (msavestring, mstrsave): Remove functions. * objfiles.c (allocate_objfile): Use xstrdup instead of mstrsave. * solib-sunos.c (allocate_rt_common_objfile): Use xstrdup instead of mstrsave. * source.c (find_and_open_source): Use xstrdup instead of mstrsave. --- gdb/ChangeLog | 10 ++++++++++ gdb/defs.h | 4 ---- gdb/objfiles.c | 4 ++-- gdb/solib-sunos.c | 2 +- gdb/source.c | 2 +- gdb/utils.c | 15 --------------- 6 files changed, 14 insertions(+), 23 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index be2b28abb66..4c5a42cc62b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2004-09-29 Mark Kettenis + + * defs.h (msavestring, mstrsave): Remove prototypes. + * utils.c (msavestring, mstrsave): Remove functions. + * objfiles.c (allocate_objfile): Use xstrdup instead of mstrsave. + * solib-sunos.c (allocate_rt_common_objfile): Use xstrdup instead + of mstrsave. + * source.c (find_and_open_source): Use xstrdup instead of + mstrsave. + 2004-09-30 Andrew Cagney * inf-ptrace.c (inf_ptrace_target): Do not set to_xfer_memory. diff --git a/gdb/defs.h b/gdb/defs.h index 63477de5968..24b7c9ae9a6 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -852,10 +852,6 @@ extern int longest_to_int (LONGEST); extern char *savestring (const char *, size_t); -extern char *msavestring (void *, const char *, size_t); - -extern char *mstrsave (void *, const char *); - /* xmalloc(), xrealloc() and xcalloc() have already been declared in "libiberty.h". */ extern void xfree (void *); diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 69f61d48688..3c4e0b402b0 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -184,7 +184,7 @@ allocate_objfile (bfd *abfd, int flags) } if (abfd != NULL) { - objfile->name = mstrsave (objfile->md, bfd_get_filename (abfd)); + objfile->name = xstrdup (bfd_get_filename (abfd)); objfile->mtime = bfd_get_mtime (abfd); /* Build section table. */ @@ -197,7 +197,7 @@ allocate_objfile (bfd *abfd, int flags) } else { - objfile->name = mstrsave (objfile->md, "<>"); + objfile->name = xstrdup ("<>"); } /* Initialize the section indexes for this objfile, so that we can diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index 872c8acd1e4..23b7dd278d3 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -146,7 +146,7 @@ allocate_rt_common_objfile (void) objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); obstack_init (&objfile->objfile_obstack); - objfile->name = mstrsave (objfile->md, "rt_common"); + objfile->name = xstrdup ("rt_common"); /* Add this file onto the tail of the linked list of other such files. */ diff --git a/gdb/source.c b/gdb/source.c index b1e9c387473..e2b6fa90f67 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -889,7 +889,7 @@ find_and_open_source (struct objfile *objfile, { char *tmp_fullname; tmp_fullname = *fullname; - *fullname = mstrsave (objfile->md, *fullname); + *fullname = xstrdup (tmp_fullname); xfree (tmp_fullname); } return result; diff --git a/gdb/utils.c b/gdb/utils.c index 1c7b73882a5..e30808c38b4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1168,21 +1168,6 @@ savestring (const char *ptr, size_t size) return p; } -char * -msavestring (void *md, const char *ptr, size_t size) -{ - char *p = (char *) xmalloc (size + 1); - memcpy (p, ptr, size); - p[size] = 0; - return p; -} - -char * -mstrsave (void *md, const char *ptr) -{ - return (msavestring (md, ptr, strlen (ptr))); -} - void print_spaces (int n, struct ui_file *file) { -- 2.30.2