aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 3810af8..d91389e 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -660,15 +660,10 @@ add_path (const char *dirname, char **which_path, int parse_separators)
more. */
if (prefix)
{
- char *temp, c;
-
- c = old[prefix];
- old[prefix] = '\0';
- temp = concat (old, tinybuf, name, (char *)NULL);
- old[prefix] = c;
- *which_path = concat (temp, "", &old[prefix], (char *) NULL);
- prefix = strlen (temp);
- xfree (temp);
+ std::string temp (old, prefix);
+ *which_path = concat (temp.c_str (), tinybuf, name, &old[prefix],
+ (char *) nullptr);
+ prefix = temp.length ();
}
else
{