diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-08-26 11:53:47 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-08-26 11:53:47 -0400 |
commit | 39e7af3e4b4e6c9f39d8d58cae73a2d307e6e1a1 (patch) | |
tree | 5fad8974eaf9c3381e142f0bc5f8ed075d910606 | |
parent | 3d9c8f6b3f033a6092425b7344647fb51dbed5c6 (diff) | |
download | gdb-39e7af3e4b4e6c9f39d8d58cae73a2d307e6e1a1.zip gdb-39e7af3e4b4e6c9f39d8d58cae73a2d307e6e1a1.tar.gz gdb-39e7af3e4b4e6c9f39d8d58cae73a2d307e6e1a1.tar.bz2 |
Make ada-lang.c::add_angle_brackets return an std::string
This removes the need for manual memory management. It may also be a
bit more efficient, since the returned string can be moved all the way
into the destination, in ada_lookup_name_info::matches.
gdb/ChangeLog:
* ada-lang.c (add_angle_brackets): Return std::string.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/ada-lang.c | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9e3d6bc..eae5c2f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2018-08-26 Simon Marchi <simon.marchi@polymtl.ca> + + * ada-lang.c (add_angle_brackets): Return std::string. + 2018-08-25 Simon Marchi <simon.marchi@polymtl.ca> * python/py-threadevent.c (py_get_event_thread): Initialize diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index db5334d..d9d3087 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -541,17 +541,12 @@ ada_unqualified_name (const char *decoded_name) return result; } -/* Return a string starting with '<', followed by STR, and '>'. - The result is good until the next call. */ +/* Return a string starting with '<', followed by STR, and '>'. */ -static char * +static std::string add_angle_brackets (const char *str) { - static char *result = NULL; - - xfree (result); - result = xstrprintf ("<%s>", str); - return result; + return string_printf ("<%s>", str); } static const char * |