diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-06-19 11:13:14 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-06-27 15:15:26 +0100 |
commit | 632c5372771a6f167f3be554b2f84582169ffc07 (patch) | |
tree | a89a65b565b0d3631729a40651f2d880f16a5206 /gdbsupport | |
parent | 88aad97c21de7a39f8e63467674ef936b3e9a86d (diff) | |
download | gdb-632c5372771a6f167f3be554b2f84582169ffc07.zip gdb-632c5372771a6f167f3be554b2f84582169ffc07.tar.gz gdb-632c5372771a6f167f3be554b2f84582169ffc07.tar.bz2 |
gdb: add overloads of gdb_tilde_expand
Like the previous commit, add two overloads of gdb_tilde_expand, one
takes std::string and other takes gdb::unique_xmalloc_ptr<char>. Make
use of these overloads throughout GDB and gdbserver.
There should be no user visible changes after this commit.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdbsupport')
-rw-r--r-- | gdbsupport/gdb_tilde_expand.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gdbsupport/gdb_tilde_expand.h b/gdbsupport/gdb_tilde_expand.h index fbd410d..f16f3a4 100644 --- a/gdbsupport/gdb_tilde_expand.h +++ b/gdbsupport/gdb_tilde_expand.h @@ -20,7 +20,21 @@ #ifndef COMMON_GDB_TILDE_EXPAND_H #define COMMON_GDB_TILDE_EXPAND_H -/* Perform tilde expansion on DIR, and return the full path. */ -extern std::string gdb_tilde_expand (const char *dir); +/* Perform tilde expansion on PATH, and return the full path. */ +extern std::string gdb_tilde_expand (const char *path); + +/* Overload of gdb_tilde_expand that takes std::string. */ +static inline std::string +gdb_tilde_expand (const std::string &path) +{ + return gdb_tilde_expand (path.c_str ()); +} + +/* Overload of gdb_tilde_expand that takes gdb::unique_xmalloc_ptr<char>. */ +static inline std::string +gdb_tilde_expand (const gdb::unique_xmalloc_ptr<char> &path) +{ + return gdb_tilde_expand (path.get ()); +} #endif /* COMMON_GDB_TILDE_EXPAND_H */ |