diff options
author | Tom Tromey <tom@tromey.com> | 2019-01-02 19:13:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-06 09:39:33 -0700 |
commit | c65bac3846567a8068fe4aa5cfa79da5b193a1af (patch) | |
tree | 991a4c4e42ab106f1af305d7d3ae8d0fe794270a /gdb/c-exp.y | |
parent | 02e12e3806bc60f66e3c446c4dfa9c06a400e604 (diff) | |
download | gdb-c65bac3846567a8068fe4aa5cfa79da5b193a1af.zip gdb-c65bac3846567a8068fe4aa5cfa79da5b193a1af.tar.gz gdb-c65bac3846567a8068fe4aa5cfa79da5b193a1af.tar.bz2 |
Remove string-related cleanup from c-exp.y
This removes a string-related cleanup from c-exp.y, by adding a new
member to c_parse_state to store the strings.
gdb/ChangeLog
2019-01-06 Tom Tromey <tom@tromey.com>
* c-exp.y (struct c_parse_state) <strings>: New member.
(operator_stoken): Update.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 54eb389..10e4ada 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -74,6 +74,9 @@ struct c_parse_state allocated during the parse. */ std::vector<std::unique_ptr<std::vector<struct type *>>> type_lists; std::vector<std::unique_ptr<struct type_stack>> type_stacks; + + /* Storage for some strings allocated during the parse. */ + std::vector<gdb::unique_xmalloc_ptr<char>> strings; }; /* This is set and cleared in c_parse. */ @@ -1743,7 +1746,7 @@ operator_stoken (const char *op) st.ptr = buf; /* The toplevel (c_parse) will free the memory allocated here. */ - make_cleanup (free, buf); + cpstate->strings.emplace_back (buf); return st; }; |