From f49d438ced7c5874dbf43976d9901a462176f541 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Fri, 20 Aug 2021 16:30:34 +0200 Subject: Cleanup and remove SEQ_ALL_BEGIN macro We now use a for_each function with callback to iterate through all sequences in the scene. This has the benefit that we now only loop over the sequences in the scene once. Before we would loop over them twice and allocate memory to store temporary data. The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop. The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once. Reviewed By: Richard Antalik, Bastien Montagne Differential Revision: http://developer.blender.org/D12278 --- source/blender/editors/sound/sound_ops.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/sound') diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fe0a53ae964..85f6647ddd0 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -207,7 +207,7 @@ static void SOUND_OT_open_mono(wmOperatorType *ot) static void sound_update_animation_flags(Scene *scene); -static int sound_update_animation_flags_fn(Sequence *seq, void *user_data) +static bool sound_update_animation_flags_fn(Sequence *seq, void *user_data) { struct FCurve *fcu; Scene *scene = (Scene *)user_data; @@ -244,24 +244,22 @@ static int sound_update_animation_flags_fn(Sequence *seq, void *user_data) sound_update_animation_flags(seq->scene); } - return 0; + return true; } static void sound_update_animation_flags(Scene *scene) { struct FCurve *fcu; bool driven; - Sequence *seq; if (scene->id.tag & LIB_TAG_DOIT) { return; } scene->id.tag |= LIB_TAG_DOIT; - SEQ_ALL_BEGIN (scene->ed, seq) { - SEQ_recursive_apply(seq, sound_update_animation_flags_fn, scene); + if (scene->ed != NULL) { + SEQ_for_each_callback(&scene->ed->seqbase, sound_update_animation_flags_fn, scene); } - SEQ_ALL_END; fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven); if (fcu || driven) { -- cgit v1.2.3