@@ -3926,6 +3926,7 @@ static EventFrame *EventFrameCreate(char *type, char *name, char *source, Source
39263926
39273927static void EventFrameDestroy (EventFrame * event )
39283928{
3929+ assert (event != NULL );
39293930 SeqDestroy (event -> children );
39303931 free (event -> filename );
39313932 free (event -> id );
@@ -3935,11 +3936,13 @@ static void EventFrameDestroy(EventFrame *event)
39353936
39363937static int EventFrameCompare (EventFrame * a , EventFrame * b )
39373938{
3939+ assert (a != NULL && b != NULL );
39383940 return strcmp (a -> id , b -> id );
39393941}
39403942
39413943static void EventFrameUpdate (EvalContext * ctx , EventFrame * last_event )
39423944{
3945+ assert (ctx != NULL );
39433946 SeqAppend (ctx -> events , last_event ); // keep track of EventFrames for cleanup
39443947
39453948 // if the event is already in the map and has shorter elapsed time, then we ignore it
@@ -3975,16 +3978,19 @@ static void EventFrameUpdate(EvalContext *ctx, EventFrame *last_event)
39753978
39763979static EventFrame * BundleToEventFrame (const Bundle * bp )
39773980{
3981+ assert (bp != NULL );
39783982 return EventFrameCreate ("bundle" , SafeStringDuplicate (bp -> name ), GetAbsolutePath (bp -> source_path ), bp -> offset );
39793983}
39803984
39813985static EventFrame * PromiseToEventFrame (const Promise * pp )
39823986{
3987+ assert (pp != NULL );
39833988 return EventFrameCreate ("promise" , SafeStringDuplicate (PromiseGetPromiseType (pp )), SafeStringDuplicate ("" ), pp -> offset );
39843989}
39853990
39863991static EventFrame * FunctionToEventFrame (const FnCall * fp )
39873992{
3993+ assert (fp != NULL );
39883994 return EventFrameCreate ("function" , SafeStringDuplicate (fp -> name ), SafeStringDuplicate ("" ), fp -> caller -> offset );
39893995}
39903996
@@ -3995,6 +4001,7 @@ static EventFrame *PolicyToEventFrame()
39954001
39964002void EvalContextAddFunctionEvent (EvalContext * ctx , FnCall * fp , long start )
39974003{
4004+ assert (ctx != NULL );
39984005 if (ctx -> profiling )
39994006 {
40004007 EventFrame * event = FunctionToEventFrame (fp );
@@ -4046,6 +4053,7 @@ long EvalContextEventStart()
40464053
40474054void EvalContextWriteEventTree (EvalContext * ctx , long start )
40484055{
4056+ assert (ctx != NULL );
40494057 long end = EvalContextEventStart ();
40504058 ctx -> root -> elapsed = end - start ;
40514059
@@ -4063,5 +4071,6 @@ void EvalContextWriteEventTree(EvalContext *ctx, long start)
40634071
40644072void EvalContextSetProfiling (EvalContext * ctx , bool profiling )
40654073{
4074+ assert (ctx != NULL );
40664075 ctx -> profiling = profiling ;
40674076}
0 commit comments