Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/38741 )
Change subject: sim: Make IniFile non-pointer in CheckpointIn
......................................................................
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 <oda...@yahoo.com.br>
---
M src/sim/serialize.cc
M src/sim/serialize.hh
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc
index 177aee6..94d0e0f 100644
--- a/src/sim/serialize.cc
+++ b/src/sim/serialize.cc
@@ -49,7 +49,6 @@
#include <cassert>
#include <cerrno>
-#include "base/inifile.hh"
#include "base/trace.hh"
#include "debug/Checkpoint.hh"
@@ -156,18 +155,14 @@
}
CheckpointIn::CheckpointIn(const string &cpt_dir)
- : db(new IniFile), _cptDir(setDir(cpt_dir))
+ : db(), _cptDir(setDir(cpt_dir))
{
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).
@@ -180,7 +175,7 @@
bool
CheckpointIn::entryExists(const string §ion, const string &entry)
{
- return db->entryExists(section, entry);
+ return db.entryExists(section, entry);
}
/**
* @param section Here we mention the section we are looking for
@@ -195,11 +190,11 @@
bool
CheckpointIn::find(const string §ion, const string &entry, string
&value)
{
- return db->find(section, entry, value);
+ return db.find(section, entry, value);
}
bool
CheckpointIn::sectionExists(const string §ion)
{
- return db->sectionExists(section);
+ return db.sectionExists(section);
}
diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh
index d4a94f2..3acefa4 100644
--- a/src/sim/serialize.hh
+++ b/src/sim/serialize.hh
@@ -56,24 +56,22 @@
#include <unordered_map>
#include <vector>
+#include "base/inifile.hh"
#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
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38741
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I784c94c8b775880def8339df63540357c2078c7b
Gerrit-Change-Number: 38741
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s