This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[COMMIT] Eliminate msavestring and mstrsave
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 30 Sep 2004 21:58:02 +0200 (CEST)
- Subject: [COMMIT] Eliminate msavestring and mstrsave
These functions were remnants of mmalloc.
Committed as obvious.
Mark
Index: ChangeLog from Mark
Kettenis <kettenis@gnu.org>
* 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.
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.167
diff -u -p -r1.167 defs.h
--- defs.h 13 Sep 2004 18:26:28 -0000 1.167
+++ defs.h 30 Sep 2004 19:54:08 -0000
@@ -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 *);
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.136
diff -u -p -r1.136 utils.c
--- utils.c 13 Sep 2004 18:26:31 -0000 1.136
+++ utils.c 30 Sep 2004 19:54:10 -0000
@@ -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)
{
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.55
diff -u -p -r1.55 objfiles.c
--- objfiles.c 2 Sep 2004 03:05:46 -0000 1.55
+++ objfiles.c 30 Sep 2004 19:54:11 -0000
@@ -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, "<<anonymous objfile>>");
+ objfile->name = xstrdup ("<<anonymous objfile>>");
}
/* Initialize the section indexes for this objfile, so that we can
Index: solib-sunos.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-sunos.c,v
retrieving revision 1.15
diff -u -p -r1.15 solib-sunos.c
--- solib-sunos.c 8 Sep 2004 14:31:15 -0000 1.15
+++ solib-sunos.c 30 Sep 2004 19:54:11 -0000
@@ -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. */
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.57
diff -u -p -r1.57 source.c
--- source.c 10 Aug 2004 21:52:05 -0000 1.57
+++ source.c 30 Sep 2004 19:54:13 -0000
@@ -889,7 +889,7 @@ find_and_open_source (struct objfile *ob
{
char *tmp_fullname;
tmp_fullname = *fullname;
- *fullname = mstrsave (objfile->md, *fullname);
+ *fullname = xstrdup (tmp_fullname);
xfree (tmp_fullname);
}
return result;