Introduce and use make_unique_xstrdup
[deliverable/binutils-gdb.git] / gdb / common / pathstuff.c
index 2b1669a5b99e2db9cbb52a4085b0ab7b42e3e3f2..e0e048d66546acea292e63c000d321cbb3767195 100644 (file)
@@ -65,7 +65,7 @@ gdb_realpath (const char *filename)
        we might not be able to display the original casing in a given
        path.  */
     if (len > 0 && len < MAX_PATH)
-      return gdb::unique_xmalloc_ptr<char> (xstrdup (buf));
+      return make_unique_xstrdup (buf);
   }
 #else
   {
@@ -77,7 +77,7 @@ gdb_realpath (const char *filename)
 #endif
 
   /* This system is a lost cause, just dup the buffer.  */
-  return gdb::unique_xmalloc_ptr<char> (xstrdup (filename));
+  return make_unique_xstrdup (filename);
 }
 
 /* See common/pathstuff.h.  */
@@ -92,7 +92,7 @@ gdb_realpath_keepfile (const char *filename)
   /* Extract the basename of filename, and return immediately
      a copy of filename if it does not contain any directory prefix.  */
   if (base_name == filename)
-    return gdb::unique_xmalloc_ptr<char> (xstrdup (filename));
+    return make_unique_xstrdup (filename);
 
   dir_name = (char *) alloca ((size_t) (base_name - filename + 2));
   /* Allocate enough space to store the dir_name + plus one extra
@@ -135,7 +135,7 @@ gdb_abspath (const char *path)
     return gdb_tilde_expand_up (path);
 
   if (IS_ABSOLUTE_PATH (path))
-    return gdb::unique_xmalloc_ptr<char> (xstrdup (path));
+    return make_unique_xstrdup (path);
 
   /* Beware the // my son, the Emacs barfs, the botch that catch...  */
   return gdb::unique_xmalloc_ptr<char>
This page took 0.034011 seconds and 4 git commands to generate.