From bcb50c1b29f48dcbd18d38bfa16f298ec817a03c Mon Sep 17 00:00:00 2001 From: def Date: Sat, 22 Jan 2022 13:47:37 +0100 Subject: [PATCH] Enable readability-const-return-type, readability-container-data-pointer, readability-delete-null-pointer --- .clang-tidy | 3 +++ src/game/client/components/maplayers.cpp | 18 +++++------------- src/game/collision.cpp | 6 ++---- src/game/server/save.cpp | 6 ++---- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index fcc5ecf4e..77469fd00 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -37,7 +37,10 @@ Checks: > -misc-unused-parameters, modernize-loop-convert, readability-avoid-const-params-in-decls, + readability-const-return-type, + readability-container-data-pointer, readability-qualified-auto, + readability-delete-null-pointer, performance-*, -performance-no-int-to-ptr, HeaderFilterRegex: 'src/.*' diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index bc739de82..772124232 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -322,19 +322,11 @@ bool CMapLayers::STileLayerVisuals::Init(unsigned int Width, unsigned int Height CMapLayers::STileLayerVisuals::~STileLayerVisuals() { - if(m_TilesOfLayer) - { - delete[] m_TilesOfLayer; - } - - if(m_BorderTop) - delete[] m_BorderTop; - if(m_BorderBottom) - delete[] m_BorderBottom; - if(m_BorderLeft) - delete[] m_BorderLeft; - if(m_BorderRight) - delete[] m_BorderRight; + delete[] m_TilesOfLayer; + delete[] m_BorderTop; + delete[] m_BorderBottom; + delete[] m_BorderLeft; + delete[] m_BorderRight; m_TilesOfLayer = NULL; m_BorderTop = NULL; diff --git a/src/game/collision.cpp b/src/game/collision.cpp index a27cebccf..c3e27b525 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -566,10 +566,8 @@ void CCollision::MoveBox(vec2 *pInoutPos, vec2 *pInoutVel, vec2 Size, float Elas void CCollision::Dest() { - if(m_pDoor) - delete[] m_pDoor; - if(m_pSwitchers) - delete[] m_pSwitchers; + delete[] m_pDoor; + delete[] m_pSwitchers; m_pTiles = 0; m_Width = 0; m_Height = 0; diff --git a/src/game/server/save.cpp b/src/game/server/save.cpp index 3283942d3..54be54a34 100644 --- a/src/game/server/save.cpp +++ b/src/game/server/save.cpp @@ -430,10 +430,8 @@ CSaveTeam::CSaveTeam(IGameController *Controller) CSaveTeam::~CSaveTeam() { - if(m_pSwitchers) - delete[] m_pSwitchers; - if(m_pSavedTees) - delete[] m_pSavedTees; + delete[] m_pSwitchers; + delete[] m_pSavedTees; } int CSaveTeam::Save(int Team)