Use nullptr instead of NULL in the code and documentation

This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.

Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.

And also use null in the assert messages.

Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
This commit is contained in:
Vadim Zeitlin 2022-10-16 01:24:34 +02:00
parent 39ea524943
commit 4f4c5fcfdf
1844 changed files with 13721 additions and 13734 deletions

View file

@ -205,10 +205,10 @@ bool MyApp::OnInit()
// My frame constructor
MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
m_treeCtrl(NULL)
: wxFrame(nullptr, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
m_treeCtrl(nullptr)
#if wxUSE_LOG
, m_textCtrl(NULL)
, m_textCtrl(nullptr)
#endif // wxUSE_LOG
{
// This reduces flicker effects - even better would be to define
@ -361,7 +361,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
MyFrame::~MyFrame()
{
#if wxUSE_LOG
delete wxLog::SetActiveTarget(NULL);
delete wxLog::SetActiveTarget(nullptr);
#endif // wxUSE_LOG
}
@ -960,7 +960,7 @@ void MyTreeCtrl::CreateImages(int size)
{
if ( size == -1 )
{
SetImageList(NULL);
SetImageList(nullptr);
return;
}
if ( size == 0 )
@ -1040,7 +1040,7 @@ void MyTreeCtrl::CreateStateImageList(bool del)
{
if ( del )
{
SetStateImageList(NULL);
SetStateImageList(nullptr);
return;
}
@ -1089,7 +1089,7 @@ void MyTreeCtrl::CreateButtonsImageList(int size)
#ifdef HAS_GENERIC_TREECTRL
if ( size == -1 )
{
SetButtonsImageList(NULL);
SetButtonsImageList(nullptr);
return;
}
@ -1289,7 +1289,7 @@ void MyTreeCtrl::DoToggleState(const wxTreeItemId& item)
int state = GetItemState(item);
int nState;
srand (time(NULL));
srand (time(nullptr));
do {
nState = rand() % GetStateImageList()->GetImageCount();
} while (nState == state);
@ -1620,7 +1620,7 @@ void MyTreeCtrl::OnItemActivated(wxTreeEvent& event)
wxTreeItemId itemId = event.GetItem();
MyTreeItemData *item = (MyTreeItemData *)GetItemData(itemId);
if ( item != NULL )
if ( item != nullptr )
{
item->ShowInfo(this);
}