aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-09-15 16:41:34 +0200
committerSimon Marchi <simon.marchi@ericsson.com>2017-09-15 16:41:34 +0200
commit3f8a7804287d3153fb4a8676b7304e67cca32be4 (patch)
tree39379c6f3d1c200c2f8256a1b923956d84a1a3c6 /gdb/dwarf2read.c
parent785922a559529420ce9b11342d7abe6ad32b3595 (diff)
downloadgdb-3f8a7804287d3153fb4a8676b7304e67cca32be4.zip
gdb-3f8a7804287d3153fb4a8676b7304e67cca32be4.tar.gz
gdb-3f8a7804287d3153fb4a8676b7304e67cca32be4.tar.bz2
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a123ea7..d97ef92 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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);