1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

No need to return MemEvent ptr from DrawAddress().

This commit is contained in:
Bartosz Taudul 2018-07-17 23:13:56 +02:00
parent 18a460e782
commit cf3bf4378b
2 changed files with 4 additions and 6 deletions

View File

@ -3101,7 +3101,6 @@ void View::DrawZoneInfoWindow()
ListMemData<decltype( v.begin() )>( v.begin(), v.end(), []( auto& v ) { ListMemData<decltype( v.begin() )>( v.begin(), v.end(), []( auto& v ) {
ImGui::Text( "0x%" PRIx64, (*v)->ptr ); ImGui::Text( "0x%" PRIx64, (*v)->ptr );
return *v;
} ); } );
ImGui::TreePop(); ImGui::TreePop();
} }
@ -5243,7 +5242,7 @@ void View::DrawMemoryAllocWindow()
} }
template<class T> template<class T>
void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress, const char* id ) void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id )
{ {
const auto& style = ImGui::GetStyle(); const auto& style = ImGui::GetStyle();
const auto dist = std::distance( ptr, end ) + 1; const auto dist = std::distance( ptr, end ) + 1;
@ -5316,7 +5315,8 @@ void View::ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAdd
int idx = 0; int idx = 0;
while( ptr != end ) while( ptr != end )
{ {
auto v = DrawAddress( ptr ); auto v = *ptr;
DrawAddress( ptr );
if( ImGui::IsItemClicked() ) if( ImGui::IsItemClicked() )
{ {
m_memoryAllocInfoWindow = std::distance( mem.data.begin(), v ); m_memoryAllocInfoWindow = std::distance( mem.data.begin(), v );
@ -5588,7 +5588,6 @@ void View::DrawMemory()
{ {
ImGui::Text( "0x%" PRIx64 "+%" PRIu64, v->ptr, m_memInfo.ptrFind - v->ptr ); ImGui::Text( "0x%" PRIx64 "+%" PRIu64, v->ptr, m_memInfo.ptrFind - v->ptr );
} }
return v;
}, "##allocations" ); }, "##allocations" );
} }
} }
@ -5629,7 +5628,6 @@ void View::DrawMemory()
ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) { ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) {
ImGui::Text( "0x%" PRIx64, (*v)->ptr ); ImGui::Text( "0x%" PRIx64, (*v)->ptr );
return *v;
}, "##activeMem" ); }, "##activeMem" );
ImGui::TreePop(); ImGui::TreePop();
} }

View File

@ -85,7 +85,7 @@ private:
void DrawMemoryAllocWindow(); void DrawMemoryAllocWindow();
template<class T> template<class T>
void ListMemData( T ptr, T end, std::function<const MemEvent*(T&)> DrawAddress, const char* id = nullptr ); void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );
void DrawInfoWindow(); void DrawInfoWindow();
void DrawZoneInfoWindow(); void DrawZoneInfoWindow();