* symfile.h (obsavestring): Don't declare.

* symfile.c (obsavestring): Remove.
	* ada-exp.y: Use obstack_copy0, not obsavestring.
	* ada-lang.c: Use obstack_copy0, not obsavestring.
	* coffread.c: Use obstack_copy0, not obsavestring.
	* cp-namespace.c: Use obstack_copy0, not obsavestring.
	* dbxread.c: Use obstack_copy0, not obsavestring.
	* dwarf2read.c: Use obstack_copy0, not obsavestring.
	* jit.c: Use obstack_copy0, not obsavestring.
	* mdebugread.c: Use obstack_copy0, not obsavestring.
	* psymtab.c: Use obstack_copy0, not obsavestring.
	* stabsread.c: Use obstack_copy0, not obsavestring.
	* xcoffread.c: Use obstack_copy0, not obsavestring.
This commit is contained in:
Tom Tromey
2013-01-21 18:13:14 +00:00
parent 86f62fd71f
commit 10f0c4bbfa
14 changed files with 81 additions and 96 deletions

View File

@@ -151,30 +151,6 @@ static VEC (sym_fns_ptr) *symtab_fns = NULL;
int auto_solib_add = 1;
/* Make a null terminated copy of the string at PTR with SIZE characters in
the obstack pointed to by OBSTACKP . Returns the address of the copy.
Note that the string at PTR does not have to be null terminated, I.e. it
may be part of a larger string and we are only saving a substring. */
char *
obsavestring (const char *ptr, int size, struct obstack *obstackp)
{
char *p = (char *) obstack_alloc (obstackp, size + 1);
/* Open-coded memcpy--saves function call time. These strings are usually
short. FIXME: Is this really still true with a compiler that can
inline memcpy? */
{
const char *p1 = ptr;
char *p2 = p;
const char *end = ptr + size;
while (p1 != end)
*p2++ = *p1++;
}
p[size] = 0;
return p;
}
/* Concatenate NULL terminated variable argument list of `const char *'
strings; return the new string. Space is found in the OBSTACKP.
Argument list must be terminated by a sentinel expression `(char *)