[vlmc-devel] Workflow: Optimize functions by returning early

Yikai Lu git at videolan.org
Sat Jul 16 17:24:19 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Sun Jul 17 00:04:59 2016 +0900| [8cfc6acf39c36ca205d15d729013af80e20b4dda] | committer: Yikai Lu

Workflow: Optimize functions by returning early

> https://code.videolan.org/videolan/vlmc/commit/8cfc6acf39c36ca205d15d729013af80e20b4dda
---

 src/Workflow/MainWorkflow.cpp  | 3 +++
 src/Workflow/TrackWorkflow.cpp | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/Workflow/MainWorkflow.cpp b/src/Workflow/MainWorkflow.cpp
index 045c64b..dd2e18f 100644
--- a/src/Workflow/MainWorkflow.cpp
+++ b/src/Workflow/MainWorkflow.cpp
@@ -247,6 +247,7 @@ MainWorkflow::moveClip( quint32 trackId, const QString& uuid, qint64 startFrame
 
             m_clips.erase( it );
             m_clips.insertMulti( trackId, clip );
+            return;
         }
     }
 }
@@ -262,6 +263,7 @@ MainWorkflow::resizeClip( const QString& uuid, qint64 newBegin, qint64 newEnd, q
             auto clip = it.value();
 
             Commands::trigger( new Commands::Clip::Resize( track( trackId ), clip, newBegin, newEnd, newPos ) );
+            return;
         }
     }
 }
@@ -277,6 +279,7 @@ MainWorkflow::removeClip( const QString& uuid )
             auto clip = it.value();
 
             Commands::trigger( new Commands::Clip::Remove( clip, track( trackId) ) );
+            return;
         }
     }
 }
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index aba5e06..32b39f8 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -158,6 +158,7 @@ TrackWorkflow::resizeClip( const QUuid &id, qint64 begin, qint64 end, qint64 pos
             {
                 auto track = trackFromFormats( clip->formats() );
                 track->resizeClip( track->clipIndexAt( it.key() ), begin, end );
+                break;
             }
         }
     }



More information about the Vlmc-devel mailing list