Use std::unique_ptr in reg_buffer
authorSimon Marchi <simon.marchi@ericsson.com>
Sun, 10 Jun 2018 02:30:34 +0000 (22:30 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sun, 10 Jun 2018 02:30:42 +0000 (22:30 -0400)
commit835dcf92618e294d3c6c2bedd94af712809c96a3
tree4c93c85f195721f4d89dd4d85b492d2670a4fe2a
parentaac0d564cea04b1c5f386e8cea924ca59057e8b4
Use std::unique_ptr in reg_buffer

Using std::unique_ptr allows to remove the manual xfree in the
destructor.

If I understand correctly, using the () after the new operator will make
sure the allocated objects will be value initialized, which for scalars
means they are zero-initialized.  So it should have the same behavior as
XCNEWVEC.

gdb/ChangeLog:

* regcache.h (reg_buffer) <~reg_buffer>: Use default destructor.
<m_registers, m_register_status>: Change type to
std::unique_ptr.
* regcache.c (reg_buffer::reg_buffer): Use new instead of
XCNEWVEC.
gdb/ChangeLog
gdb/regcache.c
gdb/regcache.h
This page took 0.024908 seconds and 4 git commands to generate.