sim: Make IniFile non-pointer in CheckpointIn

There is no need to use a pointer for this variable.

Change-Id: I784c94c8b775880def8339df63540357c2078c7b
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38741
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
Daniel R. Carvalho
2020-12-28 11:01:41 -03:00
committed by Daniel Carvalho
parent 05c0d52370
commit 43f3c51bce
2 changed files with 8 additions and 16 deletions

View File

@@ -49,7 +49,6 @@
#include <cassert>
#include <cerrno>
#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 &section, 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 &section, 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 &section)
{
return db->sectionExists(section);
return db.sectionExists(section);
}
void
CheckpointIn::visitSection(const std::string &section,
IniFile::VisitSectionCallback cb)
{
db->visitSection(section, cb);
db.visitSection(section, cb);
}

View File

@@ -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