dont bother comparing to nullptr

This commit is contained in:
Akash Mozumdar 2019-06-16 17:15:47 -04:00
parent 88b797cd33
commit 28d14bcc32
5 changed files with 6 additions and 6 deletions

View File

@ -118,7 +118,7 @@ bool ExtenWindow::eventFilter(QObject* target, QEvent* event)
void ExtenWindow::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Delete && ui->extenList->currentItem() != nullptr)
if (event->key() == Qt::Key_Delete && ui->extenList->currentItem())
{
Unload(ui->extenList->currentIndex().row());
Sync();

View File

@ -29,7 +29,7 @@ namespace
TextHook GetHook(uint64_t addr)
{
if (view == nullptr) return {};
if (!view) return {};
std::scoped_lock lock(viewMutex);
for (auto hook : view)
if (hook.address == addr) return hook;

View File

@ -14,7 +14,7 @@ struct SentenceInfo
// nullptr marks end of info array
int64_t operator[](std::string propertyName)
{
for (auto info = infoArray; info->name != nullptr; ++info) if (propertyName == info->name) return info->value;
for (auto info = infoArray; info->name; ++info) if (propertyName == info->name) return info->value;
throw;
}

View File

@ -136,7 +136,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
case DLL_PROCESS_DETACH:
{
std::lock_guard l(m);
if (window != nullptr)
if (window)
{
window->settings->setValue(WINDOW, window->geometry());
window->settings->sync();
@ -155,7 +155,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
std::lock_guard l(m);
if (window == nullptr || !sentenceInfo["current select"]) return false;
if (!window || !sentenceInfo["current select"]) return false;
QMetaObject::invokeMethod(window, [=] { window->display->setText(QString::fromStdWString(sentence)); });
return false;
}

View File

@ -127,7 +127,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
}
lua_pushstring(L, WideStringToString(sentence).c_str());
lua_createtable(L, 0, 0);
for (auto info = sentenceInfo.infoArray; info->name != nullptr; ++info)
for (auto info = sentenceInfo.infoArray; info->name; ++info)
{
lua_pushstring(L, info->name);
lua_pushinteger(L, info->value);