Replace remaining manual children checks with HasChildren().

This commit is contained in:
Bartosz Taudul 2020-02-21 00:36:45 +01:00
parent ecc9369da2
commit ba0715b295
2 changed files with 6 additions and 6 deletions

View File

@ -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++;
}

View File

@ -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 ) );