From 969edb9e0b86500ed0af9c26209ad7000adb5157 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 17 Feb 2015 23:43:43 +0100 Subject: [PATCH] player: use a macro to remove an element from an array Should be equivalent. --- player/loadfile.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/player/loadfile.c b/player/loadfile.c index 2d9f9f4e28..72e0d14590 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -658,12 +658,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);