[vlc-commits] mkv: removed unnecessary dynamic allocation
Filip Roséen
git at videolan.org
Wed Mar 9 12:59:42 CET 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Wed Mar 9 12:50:04 2016 +0100| [f85f39093988376dde26bae67da3e88ad0c67428] | committer: Jean-Baptiste Kempf
mkv: removed unnecessary dynamic allocation
Replaced the dynamic allocation with an equivalent construction on the
stack (we do not need dynamic life time since it is unconditionally
destroyed at the end of the block).
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f85f39093988376dde26bae67da3e88ad0c67428
---
modules/demux/mkv/matroska_segment.cpp | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 88fe46e..cd4d09f 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1061,22 +1061,19 @@ void matroska_segment_c::EnsureDuration()
// find the last Cluster manually
if ( !i_last_cluster_pos && cluster != NULL )
{
- EbmlElement *el;
- EbmlParser *ep;
-
es.I_O().setFilePointer( cluster->GetElementPosition(), seek_beginning );
- ep = new EbmlParser( &es , segment, &sys.demuxer,
+
+ EbmlElement* el;
+ EbmlParser ep( &es, segment, &sys.demuxer,
var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
- while( ( el = ep->Get() ) != NULL )
+ while( ( el = ep.Get() ) != NULL )
{
if ( MKV_IS_ID( el, KaxCluster ) )
{
i_last_cluster_pos = el->GetElementPosition();
}
}
-
- delete ep;
}
// find the last timecode in the Cluster
More information about the vlc-commits
mailing list