Add native target for FreeBSD/mips.
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index 5f6db60ecabfb3b69362052de01ec893d390ff4a..c93eaa34dddc6d229bbec54e99b4b9e47742f816 100644 (file)
@@ -1,5 +1,5 @@
 /* GDB routines for manipulating the minimal symbol tables.
-   Copyright (C) 1992-2016 Free Software Foundation, Inc.
+   Copyright (C) 1992-2017 Free Software Foundation, Inc.
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
    This file is part of GDB.
@@ -158,22 +158,20 @@ lookup_minimal_symbol (const char *name, const char *sfile,
   unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
   unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE;
 
-  int needtofreename = 0;
-  const char *modified_name;
+  const char *modified_name = name;
 
   if (sfile != NULL)
     sfile = lbasename (sfile);
 
   /* For C++, canonicalize the input name.  */
-  modified_name = name;
+  std::string modified_name_storage;
   if (current_language->la_language == language_cplus)
     {
-      char *cname = cp_canonicalize_string (name);
-
-      if (cname)
+      std::string cname = cp_canonicalize_string (name);
+      if (!cname.empty ())
        {
-         modified_name = cname;
-         needtofreename = 1;
+         std::swap (modified_name_storage, cname);
+         modified_name = modified_name_storage.c_str ();
        }
     }
 
@@ -272,9 +270,6 @@ lookup_minimal_symbol (const char *name, const char *sfile,
        }
     }
 
-  if (needtofreename)
-    xfree ((void *) modified_name);
-
   /* External symbols are best.  */
   if (found_symbol.minsym != NULL)
     {
@@ -943,7 +938,7 @@ minimal_symbol_reader::~minimal_symbol_reader ()
 
 void
 minimal_symbol_reader::record (const char *name, CORE_ADDR address,
-                                     enum minimal_symbol_type ms_type)
+                              enum minimal_symbol_type ms_type)
 {
   int section;
 
@@ -974,10 +969,9 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address,
 
 struct minimal_symbol *
 minimal_symbol_reader::record_full (const char *name, int name_len,
-                                          int copy_name,
-                                          CORE_ADDR address,
-                                          enum minimal_symbol_type ms_type,
-                                          int section)
+                                   bool copy_name, CORE_ADDR address,
+                                   enum minimal_symbol_type ms_type,
+                                   int section)
 {
   struct msym_bunch *newobj;
   struct minimal_symbol *msymbol;
This page took 0.027505 seconds and 4 git commands to generate.