mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Enable clang-tidy performance-* checks
This commit is contained in:
parent
21d76ed31d
commit
312b9d3bd8
|
@ -26,4 +26,5 @@ Checks: >
|
|||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
|
||||
modernize-loop-convert,
|
||||
readability-qualified-auto,
|
||||
performance-*,
|
||||
HeaderFilterRegex: 'src/.*'
|
||||
|
|
|
@ -715,7 +715,7 @@ public:
|
|||
if(FT_New_Memory_Face(m_FTLibrary, pBuf, Size, 0, &FallbackFont.m_FtFace) == 0)
|
||||
{
|
||||
dbg_msg("textrender", "loaded fallback font from '%s'", pFilename);
|
||||
pFont->m_FtFallbackFonts.emplace_back(std::move(FallbackFont));
|
||||
pFont->m_FtFallbackFonts.emplace_back(FallbackFont);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ void sqlstr::AgoTimeToString(int AgoTime, char *pAgoString, int Size)
|
|||
Seconds = aTimes[i];
|
||||
str_copy(aName, aaNames[i], sizeof(aName));
|
||||
|
||||
Count = floor((float)AgoTime / (float)Seconds);
|
||||
Count = std::floor((float)AgoTime / (float)Seconds);
|
||||
if(Count != 0)
|
||||
{
|
||||
break;
|
||||
|
@ -98,7 +98,7 @@ void sqlstr::AgoTimeToString(int AgoTime, char *pAgoString, int Size)
|
|||
str_copy(aName2, aaNames[i + 1], sizeof(aName2));
|
||||
|
||||
// add second piece if it's greater than 0
|
||||
int Count2 = floor((float)(AgoTime - (Seconds * Count)) / (float)Seconds2);
|
||||
int Count2 = std::floor((float)(AgoTime - (Seconds * Count)) / (float)Seconds2);
|
||||
|
||||
if(Count2 != 0)
|
||||
{
|
||||
|
|
|
@ -59,14 +59,14 @@ void CGhost::GetNetObjCharacter(CNetObj_Character *pChar, const CGhostCharacter
|
|||
pChar->m_Tick = pGhostChar->m_Tick;
|
||||
}
|
||||
|
||||
CGhost::CGhostPath::CGhostPath(CGhostPath &&Other) :
|
||||
CGhost::CGhostPath::CGhostPath(CGhostPath &&Other) noexcept :
|
||||
m_ChunkSize(Other.m_ChunkSize), m_NumItems(Other.m_NumItems), m_lChunks(std::move(Other.m_lChunks))
|
||||
{
|
||||
Other.m_NumItems = 0;
|
||||
Other.m_lChunks.clear();
|
||||
}
|
||||
|
||||
CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other)
|
||||
CGhost::CGhostPath &CGhost::CGhostPath::operator=(CGhostPath &&Other) noexcept
|
||||
{
|
||||
Reset(Other.m_ChunkSize);
|
||||
m_NumItems = Other.m_NumItems;
|
||||
|
|
|
@ -68,8 +68,8 @@ private:
|
|||
CGhostPath(const CGhostPath &Other) = delete;
|
||||
CGhostPath &operator=(const CGhostPath &Other) = delete;
|
||||
|
||||
CGhostPath(CGhostPath &&Other);
|
||||
CGhostPath &operator=(CGhostPath &&Other);
|
||||
CGhostPath(CGhostPath &&Other) noexcept;
|
||||
CGhostPath &operator=(CGhostPath &&Other) noexcept;
|
||||
|
||||
void Reset(int ChunkSize = 25 * 60); // one minute with default snap rate
|
||||
void SetSize(int Items);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <engine/map.h>
|
||||
|
@ -149,7 +150,7 @@ public:
|
|||
struct CSqlInitData : ISqlData
|
||||
{
|
||||
CSqlInitData(std::shared_ptr<CScoreInitResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
std::shared_ptr<CScoreInitResult> m_pResult;
|
||||
|
@ -161,7 +162,7 @@ struct CSqlInitData : ISqlData
|
|||
struct CSqlPlayerRequest : ISqlData
|
||||
{
|
||||
CSqlPlayerRequest(std::shared_ptr<CScorePlayerResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
std::shared_ptr<CScorePlayerResult> m_pResult;
|
||||
|
@ -177,7 +178,7 @@ struct CSqlPlayerRequest : ISqlData
|
|||
struct CSqlRandomMapRequest : ISqlData
|
||||
{
|
||||
CSqlRandomMapRequest(std::shared_ptr<CScoreRandomMapResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
std::shared_ptr<CScoreRandomMapResult> m_pResult;
|
||||
|
@ -191,7 +192,7 @@ struct CSqlRandomMapRequest : ISqlData
|
|||
struct CSqlScoreData : ISqlData
|
||||
{
|
||||
CSqlScoreData(std::shared_ptr<CScorePlayerResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
virtual ~CSqlScoreData(){};
|
||||
|
@ -224,7 +225,7 @@ struct CSqlTeamScoreData : ISqlData
|
|||
struct CSqlTeamSave : ISqlData
|
||||
{
|
||||
CSqlTeamSave(std::shared_ptr<CScoreSaveResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
virtual ~CSqlTeamSave(){};
|
||||
|
@ -241,7 +242,7 @@ struct CSqlTeamSave : ISqlData
|
|||
struct CSqlTeamLoad : ISqlData
|
||||
{
|
||||
CSqlTeamLoad(std::shared_ptr<CScoreSaveResult> pResult) :
|
||||
m_pResult(pResult)
|
||||
m_pResult(std::move(pResult))
|
||||
{
|
||||
}
|
||||
virtual ~CSqlTeamLoad(){};
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <game/server/gamecontext.h>
|
||||
#include <game/teamscore.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
class CGameTeams
|
||||
{
|
||||
int m_TeamState[MAX_CLIENTS];
|
||||
|
@ -123,7 +125,7 @@ public:
|
|||
|
||||
void SetSaving(int TeamID, std::shared_ptr<CScoreSaveResult> SaveResult)
|
||||
{
|
||||
m_pSaveTeamResult[TeamID] = SaveResult;
|
||||
m_pSaveTeamResult[TeamID] = std::move(SaveResult);
|
||||
}
|
||||
|
||||
bool GetSaving(int TeamID)
|
||||
|
|
Loading…
Reference in a new issue