From 05e84dccc04849857ebc4460084bdafc872d5815 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 21 Jul 2017 11:47:41 +1000 Subject: * Make XML file a class of its own managed with smart poitners * Save/restore a little more of Cocoa debugger state --- src/emu/debug/debugcpu.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/emu/debug/debugcpu.cpp') diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index dfc581d478b..e682cbdafc6 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -226,8 +226,8 @@ bool debugger_cpu::comment_save() bool comments_saved = false; // if we don't have a root, bail - util::xml::data_node *const root = util::xml::data_node::file_create(); - if (root == nullptr) + util::xml::file::ptr const root = util::xml::file::create(); + if (!root) return false; // wrap in a try/catch to handle errors @@ -269,19 +269,17 @@ bool debugger_cpu::comment_save() osd_file::error filerr = file.open(m_machine.basename(), ".cmt"); if (filerr == osd_file::error::NONE) { - root->file_write(file); + root->write(file); comments_saved = true; } } } catch (emu_exception &) { - root->file_free(); return false; } // free and get out of here - root->file_free(); return comments_saved; } @@ -301,11 +299,11 @@ bool debugger_cpu::comment_load(bool is_inline) return false; // wrap in a try/catch to handle errors - util::xml::data_node *const root = util::xml::data_node::file_read(file, nullptr); + util::xml::file::ptr const root = util::xml::file::read(file, nullptr); try { // read the file - if (root == nullptr) + if (!root) throw emu_exception(); // find the config node @@ -342,13 +340,10 @@ bool debugger_cpu::comment_load(bool is_inline) catch (emu_exception &) { // clean up in case of error - if (root != nullptr) - root->file_free(); return false; } - // free the parser - root->file_free(); + // success! return true; } -- cgit v1.2.3