Callgrind: Use member initializers and nullptr

Change-Id: I5e873e79a36a7bcd88260a3e42d3f66622f69cb4
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2018-11-07 23:49:21 +02:00
committed by Orgad Shaneh
parent a69ae41fbe
commit bc9de45213
2 changed files with 21 additions and 43 deletions

View File

@@ -45,12 +45,7 @@ class ParseData::Private {
Q_DECLARE_TR_FUNCTIONS(Valgrind::Callgrind::ParseData) Q_DECLARE_TR_FUNCTIONS(Valgrind::Callgrind::ParseData)
public: public:
Private(ParseData *q) Private(ParseData *q)
: m_pid(0) : m_q(q)
, m_lineNumberPositionIndex(-1)
, m_part(0)
, m_version(0)
, m_cycleCacheValid(false)
, m_q(q)
{ {
} }
@@ -61,11 +56,11 @@ public:
QVector<quint64> m_totalCosts; QVector<quint64> m_totalCosts;
QVector<const Function *> m_functions; QVector<const Function *> m_functions;
QString m_command; QString m_command;
quint64 m_pid; quint64 m_pid = 0;
int m_lineNumberPositionIndex; int m_lineNumberPositionIndex = -1;
uint m_part; uint m_part = 0;
int m_version; int m_version = 0;
bool m_cycleCacheValid; bool m_cycleCacheValid = false;
QStringList m_descriptions; QStringList m_descriptions;
QString m_creator; QString m_creator;

View File

@@ -139,16 +139,7 @@ class Parser::Private
public: public:
explicit Private(Parser *qq) explicit Private(Parser *qq)
: q(qq), : q(qq)
addressValuesCount(0),
costValuesCount(0),
data(0),
currentFunction(0),
lastObject(-1),
lastFile(-1),
currentDifferingFile(-1),
isParsingFunctionCall(false),
callsCount(0)
{ {
} }
@@ -174,30 +165,22 @@ public:
void parseCalledSourceFile(const char *begin, const char *end); void parseCalledSourceFile(const char *begin, const char *end);
void parseCalledObjectFile(const char *begin, const char *end); void parseCalledObjectFile(const char *begin, const char *end);
int addressValuesCount; int addressValuesCount = 0;
int costValuesCount; int costValuesCount = 0;
ParseData *data; ParseData *data = nullptr;
Function *currentFunction; Function *currentFunction = nullptr;
qint64 lastObject; qint64 lastObject = -1;
qint64 lastFile; qint64 lastFile = -1;
qint64 currentDifferingFile; qint64 currentDifferingFile = -1;
bool isParsingFunctionCall; bool isParsingFunctionCall = false;
quint64 callsCount; quint64 callsCount = 0;
struct CallData { struct CallData {
CallData() qint64 calledFunction = -1;
: calledFunction(-1) qint64 calledObject = -1;
, calledObject(-1) qint64 calledFile = -1;
, calledFile(-1) FunctionCall *call = nullptr;
, call(0)
{
}
qint64 calledFunction;
qint64 calledObject;
qint64 calledFile;
FunctionCall *call;
}; };
CallData currentCallData; CallData currentCallData;
QVector<quint64> callDestinations; QVector<quint64> callDestinations;
@@ -217,7 +200,7 @@ void Parser::Private::parse(QIODevice *device)
// be sure to clean up existing data before re-allocating // be sure to clean up existing data before re-allocating
// the callee might not have taken the parse data // the callee might not have taken the parse data
delete data; delete data;
data = 0; data = nullptr;
data = new ParseData; data = new ParseData;
parseHeader(device); parseHeader(device);