diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index 93eaf2c1fb..014e50da68 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -49,7 +49,6 @@ #include #include -#include "base/inifile.hh" #include "base/trace.hh" #include "debug/Checkpoint.hh" @@ -155,18 +154,14 @@ CheckpointIn::dir() } CheckpointIn::CheckpointIn(const std::string &cpt_dir) - : db(new IniFile), _cptDir(setDir(cpt_dir)) + : db(), _cptDir(setDir(cpt_dir)) { std::string filename = getCptDir() + "/" + CheckpointIn::baseFilename; - if (!db->load(filename)) { + if (!db.load(filename)) { fatal("Can't load checkpoint file '%s'\n", filename); } } -CheckpointIn::~CheckpointIn() -{ - delete db; -} /** * @param section Here we mention the section we are looking for * (example: currentsection). @@ -179,7 +174,7 @@ CheckpointIn::~CheckpointIn() bool CheckpointIn::entryExists(const std::string §ion, const std::string &entry) { - return db->entryExists(section, entry); + return db.entryExists(section, entry); } /** * @param section Here we mention the section we are looking for @@ -195,18 +190,18 @@ bool CheckpointIn::find(const std::string §ion, const std::string &entry, std::string &value) { - return db->find(section, entry, value); + return db.find(section, entry, value); } bool CheckpointIn::sectionExists(const std::string §ion) { - return db->sectionExists(section); + return db.sectionExists(section); } void CheckpointIn::visitSection(const std::string §ion, IniFile::VisitSectionCallback cb) { - db->visitSection(section, cb); + db.visitSection(section, cb); } diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 5bd59a467d..0acda3265b 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -60,21 +60,18 @@ #include "base/logging.hh" #include "sim/serialize_handlers.hh" -class IniFile; - typedef std::ostream CheckpointOut; class CheckpointIn { private: - - IniFile *db; + IniFile db; const std::string _cptDir; public: CheckpointIn(const std::string &cpt_dir); - ~CheckpointIn(); + ~CheckpointIn() = default; /** * @return Returns the current directory being used for creating