mirror of https://github.com/PCSX2/pcsx2.git
gsdx: use range loop instead of for_each
This commit is contained in:
parent
cf71049bd4
commit
5751e38180
|
@ -45,7 +45,7 @@ GSDevice::GSDevice()
|
|||
|
||||
GSDevice::~GSDevice()
|
||||
{
|
||||
for_each(m_pool.begin(), m_pool.end(), delete_object());
|
||||
for(auto &t : m_pool) delete t;
|
||||
|
||||
delete m_backbuffer;
|
||||
delete m_merge;
|
||||
|
@ -66,7 +66,7 @@ bool GSDevice::Create(GSWnd* wnd)
|
|||
|
||||
bool GSDevice::Reset(int w, int h)
|
||||
{
|
||||
for_each(m_pool.begin(), m_pool.end(), delete_object());
|
||||
for(auto &t : m_pool) delete t;
|
||||
|
||||
m_pool.clear();
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ GSDevice9::GSDevice9()
|
|||
|
||||
GSDevice9::~GSDevice9()
|
||||
{
|
||||
for_each(m_om_bs.begin(), m_om_bs.end(), delete_second());
|
||||
for_each(m_om_dss.begin(), m_om_dss.end(), delete_second());
|
||||
for_each(m_ps_ss.begin(), m_ps_ss.end(), delete_second());
|
||||
for_each(m_mskfix.begin(), m_mskfix.end(), delete_second());
|
||||
for(auto &i : m_om_bs) delete i.second;
|
||||
for(auto &i : m_om_dss) delete i.second;
|
||||
for(auto &i : m_ps_ss) delete i.second;
|
||||
for(auto &i : m_mskfix) delete i.second;
|
||||
|
||||
if(m_state.vs_cb) _aligned_free(m_state.vs_cb);
|
||||
if(m_state.ps_cb) _aligned_free(m_state.ps_cb);
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
virtual ~GSFunctionMap()
|
||||
{
|
||||
for_each(m_map_active.begin(), m_map_active.end(), delete_second());
|
||||
for(auto &i : m_map_active) delete i.second;
|
||||
}
|
||||
|
||||
VALUE operator [] (KEY key)
|
||||
|
|
|
@ -477,9 +477,9 @@ GSLocalMemory::~GSLocalMemory()
|
|||
else
|
||||
vmfree(m_vm8, m_vmsize * 4);
|
||||
|
||||
for_each(m_omap.begin(), m_omap.end(), aligned_free_second());
|
||||
for_each(m_pomap.begin(), m_pomap.end(), aligned_free_second());
|
||||
for_each(m_po4map.begin(), m_po4map.end(), aligned_free_second());
|
||||
for(auto &i : m_omap) _aligned_free(i.second);
|
||||
for(auto &i : m_pomap) _aligned_free(i.second);
|
||||
for(auto &i : m_po4map) _aligned_free(i.second);
|
||||
|
||||
for(hash_map<uint64, vector<GSVector2i>*>::iterator i = m_p2tmap.begin(); i != m_p2tmap.end(); ++i)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ void GSTextureCache::RemovePartial()
|
|||
|
||||
for (int type = 0; type < 2; type++)
|
||||
{
|
||||
for_each(m_dst[type].begin(), m_dst[type].end(), delete_object());
|
||||
for (auto &t : m_dst[type]) delete t;
|
||||
|
||||
m_dst[type].clear();
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void GSTextureCache::RemoveAll()
|
|||
|
||||
for(int type = 0; type < 2; type++)
|
||||
{
|
||||
for_each(m_dst[type].begin(), m_dst[type].end(), delete_object());
|
||||
for (auto &t : m_dst[type]) delete t;
|
||||
|
||||
m_dst[type].clear();
|
||||
}
|
||||
|
@ -2021,7 +2021,7 @@ void GSTextureCache::SourceMap::Add(Source* s, const GIFRegTEX0& TEX0, GSOffset*
|
|||
|
||||
void GSTextureCache::SourceMap::RemoveAll()
|
||||
{
|
||||
for_each(m_surfaces.begin(), m_surfaces.end(), delete_object());
|
||||
for (auto &t : m_surfaces) delete t;
|
||||
|
||||
m_surfaces.clear();
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void GSTextureCacheSW::InvalidatePages(const uint32* pages, uint32 psm)
|
|||
|
||||
void GSTextureCacheSW::RemoveAll()
|
||||
{
|
||||
for_each(m_textures.begin(), m_textures.end(), delete_object());
|
||||
for(auto &i : m_textures) delete i;
|
||||
|
||||
m_textures.clear();
|
||||
|
||||
|
|
|
@ -430,13 +430,6 @@ using namespace stdext;
|
|||
|
||||
extern string format(const char* fmt, ...);
|
||||
|
||||
struct delete_object {template<class T> void operator()(T& p) {delete p;}};
|
||||
struct delete_first {template<class T> void operator()(T& p) {delete p.first;}};
|
||||
struct delete_second {template<class T> void operator()(T& p) {delete p.second;}};
|
||||
struct aligned_free_object {template<class T> void operator()(T& p) {_aligned_free(p);}};
|
||||
struct aligned_free_first {template<class T> void operator()(T& p) {_aligned_free(p.first);}};
|
||||
struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_free(p.second);}};
|
||||
|
||||
extern void* vmalloc(size_t size, bool code);
|
||||
extern void vmfree(void* ptr, size_t size);
|
||||
|
||||
|
|
Loading…
Reference in New Issue