Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFPtje <none@none>2015-11-05 21:59:09 +0300
committerFPtje <none@none>2015-11-05 21:59:09 +0300
commit67c98b6bf49e623a6ceaa6f13c0c2dafca070cb1 (patch)
tree17496090d489a0021d02084bb9fe0313f43cdd1e /windirstat
parent5a7c950b899948d00e5e0aeab61fd4c517e45906 (diff)
Cache the enum of GetType()
GetType() is called very often. The cast and masking is unnecessary most of the time.
Diffstat (limited to 'windirstat')
-rw-r--r--windirstat/item.cpp5
-rw-r--r--windirstat/item.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/windirstat/item.cpp b/windirstat/item.cpp
index 89a128e..d788cf8 100644
--- a/windirstat/item.cpp
+++ b/windirstat/item.cpp
@@ -55,6 +55,7 @@ CItem::CItem(ITEMTYPE type, LPCTSTR name, bool dontFollow)
, m_readJobs(0)
, m_attributes(0)
{
+ m_etype = (ITEMTYPE)(m_type & ~ITF_FLAGS); // returned by GetType
if(GetType() == IT_FILE || dontFollow || GetType() == IT_FREESPACE || GetType() == IT_UNKNOWN || GetType() == IT_MYCOMPUTER)
{
SetReadJobDone();
@@ -829,7 +830,7 @@ double CItem::GetFraction() const
ITEMTYPE CItem::GetType() const
{
- return (ITEMTYPE)(m_type & ~ITF_FLAGS);
+ return m_etype;
}
bool CItem::IsRootItem() const
@@ -923,7 +924,7 @@ CString CItem::GetExtension() const
int i = name.ReverseFind(wds::chrDot);
if(i == -1)
{
- ext = _T(".");
+ ext = L".";
}
else
{
diff --git a/windirstat/item.h b/windirstat/item.h
index 4bcd4e3..55f2bba 100644
--- a/windirstat/item.h
+++ b/windirstat/item.h
@@ -220,6 +220,7 @@ private:
void DrivePacman();
ITEMTYPE m_type; // Indicates our type. See ITEMTYPE.
+ ITEMTYPE m_etype;
CString m_name; // Display name
mutable CString m_extension; // Cache of extension (it's used often)
mutable bool m_extension_cached = false;