summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-17 23:43:43 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-19 13:39:38 +0900
commit57deaa02d573ae28f311d2d0c13105a5d8dfda40 (patch)
treeccf956c87c291847bb781dd9a8e0fcb4025294fc
parenta6accfdad7ed6ff4c4cc497eb73106758782989d (diff)
downloadmpv-57deaa02d573ae28f311d2d0c13105a5d8dfda40.tar.bz2
mpv-57deaa02d573ae28f311d2d0c13105a5d8dfda40.tar.xz
player: use a macro to remove an element from an array
Should be equivalent. (cherry picked from commit 969edb9e0b86500ed0af9c26209ad7000adb5157)
-rw-r--r--player/loadfile.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index f483908225..27ab3a15b0 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -654,12 +654,7 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
int index = 0;
while (index < mpctx->num_tracks && mpctx->tracks[index] != track)
index++;
- assert(index < mpctx->num_tracks);
- while (index + 1 < mpctx->num_tracks) {
- mpctx->tracks[index] = mpctx->tracks[index + 1];
- index++;
- }
- mpctx->num_tracks--;
+ MP_TARRAY_REMOVE_AT(mpctx->tracks, mpctx->num_tracks, index);
talloc_free(track);
close_unused_demuxers(mpctx);