diff options
author | Tom Tromey <tom@tromey.com> | 2021-10-24 15:58:24 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-12-07 14:20:11 -0700 |
commit | c0390cb8c10d809d5abf86b190aa6f59f2891b28 (patch) | |
tree | 84a6226f52dada9ce6aefcbf3c33843fc1ff1c42 /gdb/source.c | |
parent | 9931e521bf3a057cc2770eb92906c2ae38335c5a (diff) | |
download | gdb-c0390cb8c10d809d5abf86b190aa6f59f2891b28.zip gdb-c0390cb8c10d809d5abf86b190aa6f59f2891b28.tar.gz gdb-c0390cb8c10d809d5abf86b190aa6f59f2891b28.tar.bz2 |
Remove an xfree from add_path
This removes a temporary \0 assignment and an xfree from add_path,
replacing it with a simpler use of std::string.
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 13 |
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 { |