diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-12-06 17:10:15 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-12-07 12:59:30 +0000 |
commit | 1056f22c0516cbed2d557eb6491ae4349f68b09d (patch) | |
tree | e58f5cdf9b3131b7fdaae36cc498edac007c6791 | |
parent | 1afdcac8e81c199f0312c16b42227a005b6a7701 (diff) |
Use nullptr rather than 0 or NULL for null pointers
Change-Id: Ieede3075f4beab9bbd234c0a9251c400b246abcc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | app/perfdata.h | 20 | ||||
-rw-r--r-- | app/perfsymboltable.cpp | 21 | ||||
-rw-r--r-- | app/perfunwind.cpp | 2 | ||||
-rw-r--r-- | app/perfunwind.h | 2 |
4 files changed, 26 insertions, 19 deletions
diff --git a/app/perfdata.h b/app/perfdata.h index 2ab71ee..f6b9db3 100644 --- a/app/perfdata.h +++ b/app/perfdata.h @@ -281,7 +281,8 @@ protected: class PerfRecordMmap2; class PerfRecordMmap : public PerfRecord { public: - PerfRecordMmap(PerfEventHeader *header = 0, quint64 sampleType = 0, bool sampleIdAll = false); + PerfRecordMmap(PerfEventHeader *header = nullptr, quint64 sampleType = 0, + bool sampleIdAll = false); // The pids and tids in the sampleId are always 0 in this case. Go figure ... qint32 pid() const { return m_pid; } @@ -315,7 +316,8 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordMmap &record); class PerfRecordMmap2 : public PerfRecordMmap { public: - PerfRecordMmap2(PerfEventHeader *header = 0, quint64 sampleType = 0, bool sampleIdAll = false); + PerfRecordMmap2(PerfEventHeader *header = nullptr, quint64 sampleType = 0, + bool sampleIdAll = false); quint32 prot() const { return m_prot; } @@ -339,7 +341,8 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordMmap2 &record); class PerfRecordLost : public PerfRecord { public: - PerfRecordLost(PerfEventHeader *header = 0, quint64 sampleType = 0, bool sampleIdAll = false); + PerfRecordLost(PerfEventHeader *header = nullptr, quint64 sampleType = 0, + bool sampleIdAll = false); private: quint64 m_id; quint64 m_lost; @@ -351,7 +354,8 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordLost &record); class PerfRecordComm : public PerfRecord { public: - PerfRecordComm(PerfEventHeader *header = 0, quint64 sampleType = 0, bool sampleIdAll = false); + PerfRecordComm(PerfEventHeader *header = nullptr, quint64 sampleType = 0, + bool sampleIdAll = false); const QByteArray &comm() const { return m_comm; } private: qint32 m_pid; @@ -367,7 +371,8 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordComm &record); class PerfRecordSample : public PerfRecord { public: - PerfRecordSample(const PerfEventHeader *header = 0, const PerfEventAttributes *attributes = 0); + PerfRecordSample(const PerfEventHeader *header = nullptr, + const PerfEventAttributes *attributes = nullptr); quint64 registerAbi() const { return m_registerAbi; } quint64 registerValue(int reg) const; quint64 ip() const { return m_ip; } @@ -417,7 +422,7 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordSample &record); class PerfRecordAttr : public PerfRecord { public: - PerfRecordAttr(const PerfEventHeader *header = 0, quint64 sampleType = 0, + PerfRecordAttr(const PerfEventHeader *header = nullptr, quint64 sampleType = 0, bool sampleIdAll = false); PerfRecordAttr(const PerfEventAttributes &attributes, const QList<quint64> &ids); @@ -437,7 +442,8 @@ QDataStream &operator>>(QDataStream &stream, PerfRecordAttr &record); class PerfRecordFork : public PerfRecord { public: - PerfRecordFork(PerfEventHeader *header = 0, quint64 sampleType = 0, bool sampleIdAll = false); + PerfRecordFork(PerfEventHeader *header = nullptr, quint64 sampleType = 0, + bool sampleIdAll = false); qint32 childTid() const { return m_tid; } qint32 childPid() const { return m_pid; } private: diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp index 5b3c41f..0a1b292 100644 --- a/app/perfsymboltable.cpp +++ b/app/perfsymboltable.cpp @@ -87,7 +87,7 @@ PerfSymbolTable::~PerfSymbolTable() static pid_t nextThread(Dwfl *dwfl, void *arg, void **threadArg) { /* Stop after first thread. */ - if (*threadArg != 0) + if (*threadArg != nullptr) return 0; *threadArg = arg; @@ -130,7 +130,7 @@ static bool accessDsoMem(const PerfUnwind::UnwindInfo *ui, Dwarf_Addr addr, Elf_Scn *section = dwfl_module_address_section(mod, &addr, &bias); if (section) { - Elf_Data *data = elf_getdata(section, NULL); + Elf_Data *data = elf_getdata(section, nullptr); if (data && data->d_buf && data->d_size > addr) { doMemcpy(result, static_cast<char *>(data->d_buf) + addr, wordWidth); return true; @@ -218,7 +218,7 @@ static bool setInitialRegisters(Dwfl_Thread *thread, void *arg) } static const Dwfl_Thread_Callbacks threadCallbacks = { - nextThread, NULL, memoryRead, setInitialRegisters, NULL, NULL + nextThread, nullptr, memoryRead, setInitialRegisters, nullptr, nullptr }; static bool findInExtraPath(QFileInfo &path, const QString &fileName) @@ -405,7 +405,7 @@ int PerfSymbolTable::parseDie(Dwarf_Die *top, qint32 binaryId, Dwarf_Files *file Dwarf_Word val = 0; const QByteArray file = (dwarf_formudata(dwarf_attr(top, DW_AT_call_file, &attr), &val) == 0) - ? dwarf_filesrc (files, val, NULL, NULL) : ""; + ? dwarf_filesrc (files, val, nullptr, nullptr) : ""; location.file = m_unwind->resolveString(file); location.line = (dwarf_formudata(dwarf_attr(top, DW_AT_call_line, &attr), &val) == 0) @@ -442,8 +442,8 @@ void PerfSymbolTable::parseDwarf(Dwarf_Die *cudie, Dwarf_Addr bias, qint32 binar QStack<DieAndLocation> stack; stack.push_back({*cudie, -1}); - Dwarf_Files *files = 0; - dwarf_getsrcfiles(cudie, &files, NULL); + Dwarf_Files *files = nullptr; + dwarf_getsrcfiles(cudie, &files, nullptr); while (!stack.isEmpty()) { Dwarf_Die *top = &(stack.last().die); @@ -604,11 +604,12 @@ int PerfSymbolTable::lookupFrame(Dwarf_Addr ip, bool isKernel, if (mod) { // For addrinfo we need the raw pointer into symtab, so we need to adjust ourselves. - symname = dwfl_module_addrinfo(mod, addressLocation.address, &off, &sym, 0, 0, 0); + symname = dwfl_module_addrinfo(mod, addressLocation.address, &off, &sym, nullptr, nullptr, + nullptr); Dwfl_Line *srcLine = dwfl_module_getsrc(mod, addressLocation.address); if (srcLine) { - const QByteArray file = dwfl_lineinfo(srcLine, NULL, &addressLocation.line, - &addressLocation.column, NULL, NULL); + const QByteArray file = dwfl_lineinfo(srcLine, nullptr, &addressLocation.line, + &addressLocation.column, nullptr, nullptr); addressLocation.file = m_unwind->resolveString(file); } @@ -620,7 +621,7 @@ int PerfSymbolTable::lookupFrame(Dwarf_Addr ip, bool isKernel, functionLocation.address -= off; // in case we don't find anything better Dwarf_Die *die = dwfl_module_addrdie(mod, addressLocation.address, &bias); - Dwarf_Die *scopes = NULL; + Dwarf_Die *scopes = nullptr; int nscopes = dwarf_getscopes(die, addressLocation.address - bias, &scopes); for (int i = 0; i < nscopes; ++i) { diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp index 236f9eb..0830f92 100644 --- a/app/perfunwind.cpp +++ b/app/perfunwind.cpp @@ -334,7 +334,7 @@ static int frameCallback(Dwfl_Frame *state, void *arg) // do not query for activation directly, as this could potentially advance // the unwinder internally - we must first ensure the module for the pc // is reported - if (!dwfl_frame_pc(state, &pc, NULL) + if (!dwfl_frame_pc(state, &pc, nullptr) || (ui->maxFrames != -1 && ui->frames.length() > ui->maxFrames) || pc == 0) { ui->firstGuessedFrame = ui->frames.length(); diff --git a/app/perfunwind.h b/app/perfunwind.h index a31d1c3..36b8f22 100644 --- a/app/perfunwind.h +++ b/app/perfunwind.h @@ -89,7 +89,7 @@ public: }; struct UnwindInfo { - UnwindInfo() : frames(0), unwind(0), sample(0), maxFrames(64), + UnwindInfo() : frames(0), unwind(nullptr), sample(nullptr), maxFrames(64), firstGuessedFrame(-1), isInterworking(false) {} QHash<quint32, QHash<quint64, Dwarf_Word>> stackValues; |