player: use a macro to remove an element from an array

Should be equivalent.
This commit is contained in:
wm4 2015-02-17 23:43:43 +01:00
parent f54220d951
commit 969edb9e0b
1 changed files with 1 additions and 6 deletions

View File

@ -658,12 +658,7 @@ bool mp_remove_track(struct MPContext *mpctx, struct track *track)
int index = 0; int index = 0;
while (index < mpctx->num_tracks && mpctx->tracks[index] != track) while (index < mpctx->num_tracks && mpctx->tracks[index] != track)
index++; index++;
assert(index < mpctx->num_tracks); MP_TARRAY_REMOVE_AT(mpctx->tracks, mpctx->num_tracks, index);
while (index + 1 < mpctx->num_tracks) {
mpctx->tracks[index] = mpctx->tracks[index + 1];
index++;
}
mpctx->num_tracks--;
talloc_free(track); talloc_free(track);
close_unused_demuxers(mpctx); close_unused_demuxers(mpctx);