From 97b67170277437131adf6ed4d60139c172529e4f Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 26 Mar 2019 11:13:37 +1100 Subject: (nw) Clean up the mess on master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release. --- src/lib/netlist/plib/pstate.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'src/lib/netlist/plib/pstate.cpp') diff --git a/src/lib/netlist/plib/pstate.cpp b/src/lib/netlist/plib/pstate.cpp index 043033ed1ea..3bd93ed4f8e 100644 --- a/src/lib/netlist/plib/pstate.cpp +++ b/src/lib/netlist/plib/pstate.cpp @@ -9,17 +9,6 @@ #include "palloc.h" namespace plib { -state_manager_t::state_manager_t() -{ -} - -state_manager_t::~state_manager_t() -{ - m_save.clear(); - m_custom.clear(); -} - - void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, const datatype_t &dt, const std::size_t count, void *ptr) { @@ -29,46 +18,40 @@ void state_manager_t::save_state_ptr(const void *owner, const pstring &stname, c void state_manager_t::remove_save_items(const void *owner) { - for (auto i = m_save.begin(); i != m_save.end(); ) + auto i = m_save.end(); + while (i != m_save.begin()) { + i--; if (i->get()->m_owner == owner) i = m_save.erase(i); - else - i++; } - for (auto i = m_custom.begin(); i != m_custom.end(); ) + i = m_custom.end(); + while (i > m_custom.begin()) { + i--; if (i->get()->m_owner == owner) i = m_custom.erase(i); - else - i++; } } void state_manager_t::pre_save() { for (auto & s : m_custom) - s->m_callback->on_pre_save(); + s->m_callback->on_pre_save(*this); } void state_manager_t::post_load() { for (auto & s : m_custom) - s->m_callback->on_post_load(); + s->m_callback->on_post_load(*this); } template<> void state_manager_t::save_item(const void *owner, callback_t &state, const pstring &stname) { - //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state); callback_t *state_p = &state; auto p = plib::make_unique(stname, owner, state_p); m_custom.push_back(std::move(p)); state.register_state(*this, stname); } -state_manager_t::callback_t::~callback_t() -{ -} - - -} +} // namespace plib -- cgit v1.2.3-70-g09d2