Skip to content

Commit 0bdc248

Browse files
rbernonjulliard
authored andcommitted
dmime: Rewrite segment IDirectMusicSegment_RemoveTrack.
1 parent f04976e commit 0bdc248

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

dlls/dmime/segment.c

+16-21
Original file line numberDiff line numberDiff line change
@@ -285,29 +285,24 @@ static HRESULT WINAPI segment_InsertTrack(IDirectMusicSegment8 *iface, IDirectMu
285285
return segment_append_track(This, track, group, 0);
286286
}
287287

288-
static HRESULT WINAPI segment_RemoveTrack(IDirectMusicSegment8 *iface, IDirectMusicTrack *pTrack)
288+
static HRESULT WINAPI segment_RemoveTrack(IDirectMusicSegment8 *iface, IDirectMusicTrack *track)
289289
{
290-
struct segment *This = impl_from_IDirectMusicSegment8(iface);
291-
struct list* pEntry = NULL;
292-
struct track_entry *pIt = NULL;
293-
294-
TRACE("(%p, %p)\n", This, pTrack);
295-
296-
LIST_FOR_EACH (pEntry, &This->tracks) {
297-
pIt = LIST_ENTRY(pEntry, struct track_entry, entry);
298-
if (pIt->pTrack == pTrack) {
299-
TRACE("(%p, %p): track in list\n", This, pTrack);
300-
301-
list_remove(&pIt->entry);
302-
IDirectMusicTrack_Init(pIt->pTrack, NULL);
303-
IDirectMusicTrack_Release(pIt->pTrack);
304-
free(pIt);
305-
306-
return S_OK;
290+
struct segment *This = impl_from_IDirectMusicSegment8(iface);
291+
struct track_entry *entry;
292+
293+
TRACE("(%p, %p)\n", This, track);
294+
295+
LIST_FOR_EACH_ENTRY(entry, &This->tracks, struct track_entry, entry)
296+
{
297+
if (entry->pTrack == track)
298+
{
299+
list_remove(&entry->entry);
300+
track_entry_destroy(entry);
301+
return S_OK;
302+
}
307303
}
308-
}
309-
310-
return S_FALSE;
304+
305+
return S_FALSE;
311306
}
312307

313308
static HRESULT WINAPI segment_InitPlay(IDirectMusicSegment8 *iface,

0 commit comments

Comments
 (0)