diff options
author | Tom Tromey <tom@tromey.com> | 2017-08-03 16:34:56 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-08-22 09:30:11 -0600 |
commit | 4971c9a74b47103582834e46d0185390379e60b3 (patch) | |
tree | 222a7707d371fc4eda57210839ae91c900132960 /gdb/utils.c | |
parent | e3e41d588adbe26a6ca54338dd4915382d981a3e (diff) | |
download | gdb-4971c9a74b47103582834e46d0185390379e60b3.zip gdb-4971c9a74b47103582834e46d0185390379e60b3.tar.gz gdb-4971c9a74b47103582834e46d0185390379e60b3.tar.bz2 |
Change gdb_realpath_keepfile to return a unique_xmalloc_ptr
This changes gdb_realpath_keepfile to return a unique_xmalloc_ptr, and
fixes up the callers.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* utils.c (gdb_realpath_keepfile): Return a
gdb::unique_xmalloc_ptr.
* exec.c (exec_file_attach): Update.
* utils.h (gdb_realpath_keepfile): Return a
gdb::unique_xmalloc_ptr.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/utils.c b/gdb/utils.c index 9959c01..5bdc638 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2716,7 +2716,7 @@ gdb_realpath (const char *filename) /* Return a copy of FILENAME, with its directory prefix canonicalized by gdb_realpath. */ -char * +gdb::unique_xmalloc_ptr<char> gdb_realpath_keepfile (const char *filename) { const char *base_name = lbasename (filename); @@ -2727,7 +2727,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 xstrdup (filename); + return gdb::unique_xmalloc_ptr<char> (xstrdup (filename)); dir_name = (char *) alloca ((size_t) (base_name - filename + 2)); /* Allocate enough space to store the dir_name + plus one extra @@ -2756,7 +2756,7 @@ gdb_realpath_keepfile (const char *filename) result = concat (real_path, SLASH_STRING, base_name, (char *) NULL); xfree (real_path); - return result; + return gdb::unique_xmalloc_ptr<char> (result); } /* Return PATH in absolute form, performing tilde-expansion if necessary. |