dwarf2read: Replace copy_string usages with savestring

copy_string does the exact same thing as savestring, so replace the
usages of the former with the latter.

gdb/ChangeLog:

	* dwarf2read.c (copy_string): Remove.
	(parse_macro_definition): Replace copy_string with savestring.
This commit is contained in:
Simon Marchi 2017-09-15 16:41:34 +02:00
parent 785922a559
commit 3f8a780428
2 changed files with 8 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2017-09-15 Simon Marchi <simon.marchi@ericsson.com>
* dwarf2read.c (copy_string): Remove.
(parse_macro_definition): Replace copy_string with savestring.
2017-09-15 Yao Qi <yao.qi@linaro.org>
* configure.tgt (i[34567]86-*-darwin*): Append amd64.o to

View File

@ -21685,20 +21685,6 @@ macro_start_file (int file, int line,
return current_file;
}
/* Copy the LEN characters at BUF to a xmalloc'ed block of memory,
followed by a null byte. */
static char *
copy_string (const char *buf, int len)
{
char *s = (char *) xmalloc (len + 1);
memcpy (s, buf, len);
s[len] = '\0';
return s;
}
static const char *
consume_improper_spaces (const char *p, const char *body)
{
@ -21758,7 +21744,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
{
/* It's an object-like macro. */
int name_len = p - body;
char *name = copy_string (body, name_len);
char *name = savestring (body, name_len);
const char *replacement;
if (*p == ' ')
@ -21776,7 +21762,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
else if (*p == '(')
{
/* It's a function-like macro. */
char *name = copy_string (body, p - body);
char *name = savestring (body, p - body);
int argc = 0;
int argv_size = 1;
char **argv = XNEWVEC (char *, argv_size);
@ -21805,7 +21791,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
argv = XRESIZEVEC (char *, argv, argv_size);
}
argv[argc++] = copy_string (arg_start, p - arg_start);
argv[argc++] = savestring (arg_start, p - arg_start);
}
p = consume_improper_spaces (p, body);