Commit ebb52a4c authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Use nullptr

parent 508e28bd
......@@ -118,7 +118,7 @@ int main(int argc, char** argv)
return 1;
}
}
Q_ASSERT( et!=0 );
Q_ASSERT( et!=nullptr );
out << "Sorted by: " << (sortByExcl ? "Exclusive ":"Inclusive ")
<< et->longName() << " (" << et->name() << ")" << endl;
......
......@@ -39,9 +39,9 @@ ConfigDlg::ConfigDlg(GlobalGUIConfig* c, TraceData* data,
{
_config = c;
_data = data;
_objectCS = 0;
_classCS = 0;
_fileCS = 0;
_objectCS = nullptr;
_classCS = nullptr;
_fileCS = nullptr;
connect(objectCombo, SIGNAL(activated(QString)),
this, SLOT(objectActivated(QString)));
......@@ -206,7 +206,7 @@ void ConfigDlg::objectActivated(const QString & s)
{
// qDebug("objectActivated: %s", s.ascii());
if (s.isEmpty()) { _objectCS=0; return; }
if (s.isEmpty()) { _objectCS=nullptr; return; }
QString n = ProfileContext::typeName(ProfileContext::Object) + '-' + s;
......@@ -250,7 +250,7 @@ void ConfigDlg::classActivated(const QString & s)
{
// qDebug("classActivated: %s", s.ascii());
if (s.isEmpty()) { _classCS=0; return; }
if (s.isEmpty()) { _classCS=nullptr; return; }
QString n = ProfileContext::typeName(ProfileContext::Class) + '-' + s;
......@@ -281,7 +281,7 @@ void ConfigDlg::fileActivated(const QString & s)
{
// qDebug("fileActivated: %s", s.ascii());
if (s.isEmpty()) { _fileCS=0; return; }
if (s.isEmpty()) { _fileCS=nullptr; return; }
QString n = ProfileContext::typeName(ProfileContext::File) + '-' + s;
......@@ -309,20 +309,20 @@ void ConfigDlg::fileColorChanged(const QColor & c)
QTreeWidgetItem *ConfigDlg::getSelectedDirItem()
{
const QList<QTreeWidgetItem*> selectedItems = dirList->selectedItems();
return selectedItems.count() ? selectedItems[0] : NULL;
return selectedItems.count() ? selectedItems[0] : nullptr;
}
void ConfigDlg::dirsItemChanged()
{
QTreeWidgetItem *dirItem = getSelectedDirItem();
deleteDirButton->setEnabled(dirItem && dirItem->parent() != NULL);
addDirButton->setEnabled(dirItem && dirItem->parent() == NULL);
deleteDirButton->setEnabled(dirItem && dirItem->parent() != nullptr);
addDirButton->setEnabled(dirItem && dirItem->parent() == nullptr);
}
void ConfigDlg::dirsDeletePressed()
{
QTreeWidgetItem *dirItem = getSelectedDirItem();
if (!dirItem || (dirItem->parent() == 0)) return;
if (!dirItem || (dirItem->parent() == nullptr)) return;
QTreeWidgetItem* p = dirItem->parent();
if (!p) return;
......@@ -343,7 +343,7 @@ void ConfigDlg::dirsDeletePressed()
void ConfigDlg::dirsAddPressed()
{
QTreeWidgetItem *dirItem = getSelectedDirItem();
if (!dirItem || (dirItem->parent() != 0)) return;
if (!dirItem || (dirItem->parent() != nullptr)) return;
QString objName = dirItem->text(0);
......
......@@ -44,7 +44,7 @@ class ConfigDlg : public ConfigDlgBase
public:
ConfigDlg(GlobalGUIConfig*, TraceData*,
QWidget* parent = 0);
QWidget* parent = nullptr);
~ConfigDlg() override;
static bool configure(GlobalGUIConfig*, TraceData*, QWidget*);
......
......@@ -47,7 +47,7 @@ KDEConfigGroup::~KDEConfigGroup()
void KDEConfigGroup::setValue(const QString& key, const QVariant& value,
const QVariant& defaultValue)
{
if ((_kgroup == 0) || _readOnly) return;
if ((_kgroup == nullptr) || _readOnly) return;
if (value == defaultValue) {
_kgroup->deleteEntry(key);
......@@ -82,7 +82,7 @@ void KDEConfigGroup::setValue(const QString& key, const QVariant& value,
QVariant KDEConfigGroup::value(const QString& key,
const QVariant& defaultValue) const
{
if (_kgroup == 0) return defaultValue;
if (_kgroup == nullptr) return defaultValue;
switch(defaultValue.type()) {
case QVariant::Bool:
......@@ -135,7 +135,7 @@ ConfigGroup* KDEConfigStorage::getGroup(const QString& group,
else if (gList.contains(group))
g = new KConfigGroup(_kconfig, group);
else
g = 0;
g = nullptr;
}
else {
readOnly = false;
......
......@@ -79,15 +79,15 @@
#include "callgraphview.h"
TopLevel::TopLevel()
: KXmlGuiWindow(0)
: KXmlGuiWindow(nullptr)
{
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KCachegrind"), this, QDBusConnection::ExportScriptableSlots);
_progressBar = 0;
_progressBar = nullptr;
_statusbar = statusBar();
_statusLabel = new QLabel(_statusbar);
_statusbar->addWidget(_statusLabel, 1);
_ccProcess = 0;
_ccProcess = nullptr;
_layoutCount = 1;
_layoutCurrent = 0;
......@@ -157,21 +157,21 @@ void TopLevel::resetState()
_activeParts.clear();
_hiddenParts.clear();
_data = 0;
_function = 0;
_eventType = 0;
_eventType2 = 0;
_data = nullptr;
_function = nullptr;
_eventType = nullptr;
_eventType2 = nullptr;
_groupType = ProfileContext::InvalidType;
_group = 0;
_group = nullptr;
// for delayed slots
_traceItemDelayed = 0;
_eventTypeDelayed = 0;
_eventType2Delayed = 0;
_traceItemDelayed = nullptr;
_eventTypeDelayed = nullptr;
_eventType2Delayed = nullptr;
_groupTypeDelayed = ProfileContext::InvalidType;
_groupDelayed = 0;
_groupDelayed = nullptr;
_directionDelayed = TraceItemView::None;
_lastSender = 0;
_lastSender = nullptr;
}
......@@ -1092,7 +1092,7 @@ bool TopLevel::setEventType(QString s)
{
EventType* ct;
ct = (_data) ? _data->eventTypes()->type(s) : 0;
ct = (_data) ? _data->eventTypes()->type(s) : nullptr;
// if costtype with given name not found, use first available
if (!ct && _data) ct = _data->eventTypes()->type(0);
......@@ -1105,7 +1105,7 @@ bool TopLevel::setEventType2(QString s)
EventType* ct;
// Special type i18n("(Hidden)") gives 0
ct = (_data) ? _data->eventTypes()->type(s) : 0;
ct = (_data) ? _data->eventTypes()->type(s) : nullptr;
return setEventType2(ct);
}
......@@ -1114,7 +1114,7 @@ void TopLevel::eventTypeSelected(const QString& s)
{
EventType* ct;
ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0;
ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr;
setEventType(ct);
}
......@@ -1122,7 +1122,7 @@ void TopLevel::eventType2Selected(const QString& s)
{
EventType* ct;
ct = (_data) ? _data->eventTypes()->typeForLong(s) : 0;
ct = (_data) ? _data->eventTypes()->typeForLong(s) : nullptr;
setEventType2(ct);
}
......@@ -1366,9 +1366,9 @@ void TopLevel::setDirectionDelayed()
case TraceItemView::Up:
{
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
HistoryItem* hi = b ? b->current() : 0;
TraceFunction* f = hi ? hi->function() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
HistoryItem* hi = b ? b->current() : nullptr;
TraceFunction* f = hi ? hi->function() : nullptr;
if (!f) break;
f = hi->stack()->caller(f, false);
......@@ -1429,8 +1429,8 @@ void TopLevel::setTraceItemDelayed()
default: break;
}
_traceItemDelayed = 0;
_lastSender = 0;
_traceItemDelayed = nullptr;
_lastSender = nullptr;
}
/**
......@@ -1443,15 +1443,15 @@ void TopLevel::setData(TraceData* data)
{
if (data == _data) return;
_lastSender = 0;
_lastSender = nullptr;
saveTraceSettings();
if (_data) {
_partSelection->setData(0);
_stackSelection->setData(0);
_functionSelection->setData(0);
_multiView->setData(0);
_partSelection->setData(nullptr);
_stackSelection->setData(nullptr);
_functionSelection->setData(nullptr);
_multiView->setData(nullptr);
_multiView->updateView(true);
// we are the owner...
......@@ -1526,7 +1526,7 @@ void TopLevel::setData(TraceData* data)
void TopLevel::addEventTypeMenu(QMenu* popup, bool withCost2)
{
if (_data) {
QMenu *popup1, *popup2 = 0;
QMenu *popup1, *popup2 = nullptr;
QAction* action;
popup1 = popup->addMenu(i18n("Primary Event Type"));
......@@ -1591,10 +1591,10 @@ void TopLevel::addEventTypeMenu(QMenu* popup, bool withCost2)
bool TopLevel::setEventType(QAction* action)
{
if (!_data) return false;
int id = action->data().toInt(0);
int id = action->data().toInt(nullptr);
EventTypeSet* m = _data->eventTypes();
EventType* ct=0;
EventType* ct=nullptr;
if (id >=100 && id<199) ct = m->realType(id-100);
if (id >=200 && id<299) ct = m->derivedType(id-200);
......@@ -1604,10 +1604,10 @@ bool TopLevel::setEventType(QAction* action)
bool TopLevel::setEventType2(QAction* action)
{
if (!_data) return false;
int id = action->data().toInt(0);
int id = action->data().toInt(nullptr);
EventTypeSet* m = _data->eventTypes();
EventType* ct=0;
EventType* ct=nullptr;
if (id >=100 && id<199) ct = m->realType(id-100);
if (id >=200 && id<299) ct = m->derivedType(id-200);
......@@ -2031,14 +2031,14 @@ void TopLevel::forceTrace()
qDebug("TopLevel::forceTrace: killing old callgrind_control");
_ccProcess->kill();
delete _ccProcess;
_ccProcess = 0;
_ccProcess = nullptr;
_ccOutput = QString();
}
if (!_taDump->isChecked()) return;
// get PID of first loaded part
int pid = 0;
TracePart* p = 0;
TracePart* p = nullptr;
TracePartList pl;
if (_data) pl = _data->parts();
if (!pl.isEmpty()) p = pl.first();
......@@ -2088,7 +2088,7 @@ void TopLevel::ccError(QProcess::ProcessError e)
showMessage(i18n("Error running callgrind_control"), 5000);
_ccProcess->deleteLater();
_ccProcess = 0;
_ccProcess = nullptr;
}
void TopLevel::ccExit(int exitCode, QProcess::ExitStatus s)
......@@ -2101,7 +2101,7 @@ void TopLevel::ccExit(int exitCode, QProcess::ExitStatus s)
if (!_ccProcess) return;
if (p != _ccProcess) return;
_ccProcess->deleteLater();
_ccProcess = 0;
_ccProcess = nullptr;
_taDump->setChecked(false);
// if not successful no need to reload
......@@ -2118,8 +2118,8 @@ void TopLevel::forwardAboutToShow()
QMenu *popup = _paForward->menu();
popup->clear();
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
HistoryItem* hi = b ? b->current() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
HistoryItem* hi = b ? b->current() : nullptr;
TraceFunction* f;
QAction* action;
......@@ -2155,8 +2155,8 @@ void TopLevel::backAboutToShow()
QMenu *popup = _paBack->menu();
popup->clear();
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
HistoryItem* hi = b ? b->current() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
HistoryItem* hi = b ? b->current() : nullptr;
TraceFunction* f;
QAction* action;
......@@ -2192,9 +2192,9 @@ void TopLevel::upAboutToShow()
QMenu *popup = _paUp->menu();
popup->clear();
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
HistoryItem* hi = b ? b->current() : 0;
TraceFunction* f = hi ? hi->function() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
HistoryItem* hi = b ? b->current() : nullptr;
TraceFunction* f = hi ? hi->function() : nullptr;
QAction* action;
if (!f) {
......@@ -2222,12 +2222,12 @@ void TopLevel::upAboutToShow()
void TopLevel::forwardTriggered(QAction* action)
{
int count = action->data().toInt(0);
int count = action->data().toInt(nullptr);
//qDebug("forwardTriggered: %d", count);
if( count <= 0)
return;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
if (!b) return;
while (count>1) {
......@@ -2239,12 +2239,12 @@ void TopLevel::forwardTriggered(QAction* action)
void TopLevel::backTriggered(QAction* action)
{
int count = action->data().toInt(0);
int count = action->data().toInt(nullptr);
//qDebug("backTriggered: %d", count);
if( count <= 0)
return;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
if (!b) return;
while (count>1) {
......@@ -2256,13 +2256,13 @@ void TopLevel::backTriggered(QAction* action)
void TopLevel::upTriggered(QAction* action)
{
int count = action->data().toInt(0);
int count = action->data().toInt(nullptr);
//qDebug("upTriggered: %d", count);
if( count <= 0)
return;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : 0;
HistoryItem* hi = b ? b->current() : 0;
StackBrowser* b = _stackSelection ? _stackSelection->browser() : nullptr;
HistoryItem* hi = b ? b->current() : nullptr;
if (!hi) return;
TraceFunction* f = hi->function();
......@@ -2294,7 +2294,7 @@ void TopLevel::showStatus(const QString& msg, int progress)
if (_progressBar) {
_statusbar->removeWidget(_progressBar);
delete _progressBar;
_progressBar = 0;
_progressBar = nullptr;
}
_statusbar->clearMessage();
_progressMsg = msg;
......
......@@ -362,10 +362,10 @@ TraceObject* CachegrindLoader::compressedObject(const QString& name)
int p = name.indexOf(')');
if (p<2) {
error(QStringLiteral("Invalid compressed ELF object ('%1')").arg(name));
return 0;
return nullptr;
}
int index = name.midRef(1, p-1).toInt();
TraceObject* o = 0;
TraceObject* o = nullptr;
p++;
while((name.length()>p) && name.at(p).isSpace()) p++;
if (name.length()>p) {
......@@ -390,9 +390,9 @@ TraceObject* CachegrindLoader::compressedObject(const QString& name)
}
else {
if ((_objectVector.size() <= index) ||
( (o=(TraceObject*)_objectVector.at(index)) == 0)) {
( (o=(TraceObject*)_objectVector.at(index)) == nullptr)) {
error(QStringLiteral("Undefined compressed ELF object index %1").arg(index));
return 0;
return nullptr;
}
}
......@@ -410,10 +410,10 @@ TraceFile* CachegrindLoader::compressedFile(const QString& name)
int p = name.indexOf(')');
if (p<2) {
error(QStringLiteral("Invalid compressed file ('%1')").arg(name));
return 0;
return nullptr;
}
int index = name.midRef(1, p-1).toUInt();
TraceFile* f = 0;
TraceFile* f = nullptr;
p++;
while((name.length()>p) && name.at(p).isSpace()) p++;
if (name.length()>p) {
......@@ -438,9 +438,9 @@ TraceFile* CachegrindLoader::compressedFile(const QString& name)
}
else {
if ((_fileVector.size() <= index) ||
( (f=(TraceFile*)_fileVector.at(index)) == 0)) {
( (f=(TraceFile*)_fileVector.at(index)) == nullptr)) {
error(QStringLiteral("Undefined compressed file index %1").arg(index));
return 0;
return nullptr;
}
}
......@@ -461,12 +461,12 @@ TraceFunction* CachegrindLoader::compressedFunction(const QString& name,
int p = name.indexOf(')');
if (p<2) {
error(QStringLiteral("Invalid compressed function ('%1')").arg(name));
return 0;
return nullptr;
}
int index = name.midRef(1, p-1).toUInt();
TraceFunction* f = 0;
TraceFunction* f = nullptr;
p++;
while((name.length()>p) && name.at(p).isSpace()) p++;
if (name.length()>p) {
......@@ -499,9 +499,9 @@ TraceFunction* CachegrindLoader::compressedFunction(const QString& name,
}
else {
if ((_functionVector.size() <= index) ||
( (f=(TraceFunction*)_functionVector.at(index)) == 0)) {
( (f=(TraceFunction*)_functionVector.at(index)) == nullptr)) {
error(QStringLiteral("Undefined compressed function index %1").arg(index));
return 0;
return nullptr;
}
// there was a check if the used function (returned from KCachegrinds
......@@ -533,8 +533,8 @@ void CachegrindLoader::setObject(const QString& name)
}
currentPartObject = currentObject->partObject(_part);
currentFunction = 0;
currentPartFunction = 0;
currentFunction = nullptr;
currentPartFunction = nullptr;
}
void CachegrindLoader::setCalledObject(const QString& name)
......@@ -571,8 +571,8 @@ void CachegrindLoader::setFile(const QString& name)
}
currentPartFile = currentFile->partFile(_part);
currentLine = 0;
currentPartLine = 0;
currentLine = nullptr;
currentPartLine = nullptr;
}
void CachegrindLoader::setCalledFile(const QString& name)
......@@ -627,9 +627,9 @@ void CachegrindLoader::setFunction(const QString& name)
currentPartFile,
currentPartObject);
currentFunctionSource = 0;
currentLine = 0;
currentPartLine = 0;
currentFunctionSource = nullptr;
currentLine = nullptr;
currentPartLine = nullptr;
}
void CachegrindLoader::setCalledFunction(const QString& name)
......@@ -669,43 +669,43 @@ void CachegrindLoader::clearPosition()
currentPos = PositionSpec();
// current function/line
currentFunction = 0;
currentPartFunction = 0;
currentFunctionSource = 0;
currentFile = 0;
currentFunctionFile = 0;
currentPartFile = 0;
currentObject = 0;
currentPartObject = 0;
currentLine = 0;
currentPartLine = 0;
currentInstr = 0;
currentPartInstr = 0;
currentFunction = nullptr;
currentPartFunction = nullptr;
currentFunctionSource = nullptr;
currentFile = nullptr;
currentFunctionFile = nullptr;
currentPartFile = nullptr;
currentObject = nullptr;
currentPartObject = nullptr;
currentLine = nullptr;
currentPartLine = nullptr;
currentInstr = nullptr;
currentPartInstr = nullptr;
// current call
currentCalledObject = 0;
currentCalledPartObject = 0;
currentCalledFile = 0;
currentCalledPartFile = 0;
currentCalledFunction = 0;
currentCalledPartFunction = 0;
currentCalledObject = nullptr;
currentCalledPartObject = nullptr;
currentCalledFile = nullptr;
currentCalledPartFile = nullptr;
currentCalledFunction = nullptr;
currentCalledPartFunction = nullptr;
currentCallCount = 0;
// current jump
currentJumpToFile = 0;
currentJumpToFunction = 0;
currentJumpToFile = nullptr;
currentJumpToFunction = nullptr;
targetPos = PositionSpec();
jumpsFollowed = 0;
jumpsExecuted = 0;
mapping = 0;
mapping = nullptr;
}
void CachegrindLoader::prepareNewPart()
{
if (_part) {
// really new part needed?
if (mapping == 0) return;
if (mapping == nullptr) return;
// yes
_part->invalidate();
......@@ -749,7 +749,7 @@ int CachegrindLoader::loadInternal(TraceData* data,
FixPool* pool = _data->fixPool();
#endif
_part = 0;
_part = nullptr;
partsAdded = 0;
prepareNewPart();
......@@ -1266,10 +1266,10 @@ int CachegrindLoader::loadInternal(TraceData* data,
_data->updateMaxCallCount(partLineCall->callCount());
}
#endif
currentCalledFile = 0;
currentCalledPartFile = 0;
currentCalledObject = 0;
currentCalledPartObject = 0;
currentCalledFile = nullptr;
currentCalledPartFile = nullptr;
currentCalledObject = nullptr;
currentCalledPartObject = nullptr;
currentCallCount = 0;
if (!line.isEmpty()) {
......@@ -1348,8 +1348,8 @@ int CachegrindLoader::loadInternal(TraceData* data,
}
nextLineType = SelfCost;
currentJumpToFunction = 0;
currentJumpToFile = 0;
currentJumpToFunction = nullptr;
currentJumpToFile = nullptr;
if (!line.isEmpty()) {
error(QStringLiteral("Garbage at end of jump cost line ('%1')").arg(line));
......