diff options
Diffstat (limited to 'gdb/xcoffread.c')
-rw-r--r-- | gdb/xcoffread.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index d3e9ade..f6db7f9 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -2734,13 +2734,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, case 'f': if (! pst) { - int name_len = p - namestring; - char *name = (char *) xmalloc (name_len + 1); - - memcpy (name, namestring, name_len); - name[name_len] = '\0'; - function_outside_compilation_unit_complaint (name); - xfree (name); + std::string name (namestring, (p - namestring)); + function_outside_compilation_unit_complaint (name.c_str ()); } pst->add_psymbol (gdb::string_view (namestring, p - namestring), @@ -2758,13 +2753,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, case 'F': if (! pst) { - int name_len = p - namestring; - char *name = (char *) xmalloc (name_len + 1); - - memcpy (name, namestring, name_len); - name[name_len] = '\0'; - function_outside_compilation_unit_complaint (name); - xfree (name); + std::string name (namestring, (p - namestring)); + function_outside_compilation_unit_complaint (name.c_str ()); } /* We need only the minimal symbols for these |