From ba0715b295b6e35dd5d0ecd7ea2572f59254cb21 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 21 Feb 2020 00:36:45 +0100 Subject: [PATCH] Replace remaining manual children checks with HasChildren(). --- server/TracyView.cpp | 10 +++++----- server/TracyWorker.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1453c30f..a18c90fd 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3341,7 +3341,7 @@ int View::DrawZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co const auto color = GetZoneColor( ev, tid, depth ); const char* zoneName = m_worker.GetZoneName( ev ); - if( ev.Child() >= 0 ) + if( ev.HasChildren() ) { const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); if( d > maxdepth ) maxdepth = d; @@ -3493,7 +3493,7 @@ int View::SkipZoneLevel( const V& vec, bool hover, double pxns, int64_t nspx, co } else { - if( ev.Child() >= 0 ) + if( ev.HasChildren() ) { const auto d = DispatchZoneLevel( m_worker.GetZoneChildren( ev.Child() ), hover, pxns, nspx, wpos, _offset, depth, yMin, yMax, tid ); if( d > maxdepth ) maxdepth = d; @@ -5776,7 +5776,7 @@ void View::CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, un it->second.time += t; it->second.count++; } - if( a(child).Child() >= 0 ) CalcZoneTimeData( ctx, data, it->second.time, a(child) ); + if( a(child).HasChildren() ) CalcZoneTimeData( ctx, data, it->second.time, a(child) ); } } @@ -14314,7 +14314,7 @@ int View::GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const if( it != vec->begin() ) --it; assert( !( zone.IsEndValid() && it->Start() > zone.End() ) ); if( it == &zone ) return depth; - assert( it->Child() >= 0 ); + assert( it->HasChildren() ); timeline = &m_worker.GetZoneChildren( it->Child() ); depth++; } @@ -14324,7 +14324,7 @@ int View::GetZoneDepth( const ZoneEvent& zone, uint64_t tid ) const if( it != timeline->begin() ) --it; assert( !( zone.IsEndValid() && (*it)->Start() > zone.End() ) ); if( *it == &zone ) return depth; - assert( (*it)->Child() >= 0 ); + assert( (*it)->HasChildren() ); timeline = &m_worker.GetZoneChildren( (*it)->Child() ); depth++; } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index f285dcc4..29d7dbd4 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -5842,7 +5842,7 @@ void Worker::WriteTimelineImpl( FileWrite& f, const V& vec, int64_t& refTime ) int64_t start = v.Start(); WriteTimeOffset( f, refTime, start ); f.Write( &v.extra, sizeof( v.extra ) ); - if( v.Child() < 0 ) + if( !v.HasChildren() ) { const uint32_t sz = 0; f.Write( &sz, sizeof( sz ) );