diff options
author | waker <wakeroid@gmail.com> | 2011-05-10 21:58:38 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-05-10 21:58:38 +0200 |
commit | 32a2a4cea0d9397d7cd618c8ce835aac980fe359 (patch) | |
tree | a1e6c99690debfceda859945f116510d34154da2 /playlist.c | |
parent | 9d529eb05995069583ffa3e07670c0ea23b42b15 (diff) |
added remaining plt_* replacements; minor fixups
Diffstat (limited to 'playlist.c')
-rw-r--r-- | playlist.c | 49 |
1 files changed, 24 insertions, 25 deletions
@@ -1723,7 +1723,7 @@ plt_remove_item (playlist_t *playlist, playItem_t *it) { } int -plt_getcount (playlist_t *plt, int iter) { +plt_get_item_count (playlist_t *plt, int iter) { return plt->count[iter]; } @@ -1761,7 +1761,7 @@ pl_getselcount (void) { } playItem_t * -pl_get_for_idx_and_iter (int idx, int iter) { +plt_get_item_for_idx (playlist_t *playlist, int idx, int iter) { LOCK; playItem_t *it = playlist->head[iter]; while (idx--) { @@ -1779,17 +1779,20 @@ pl_get_for_idx_and_iter (int idx, int iter) { } playItem_t * -pl_get_for_idx (int idx) { - return pl_get_for_idx_and_iter (idx, PL_MAIN); +pl_get_for_idx_and_iter (int idx, int iter) { + LOCK; + playItem_t *it = plt_get_item_for_idx (playlist, idx, iter); + UNLOCK; + return it; } -int -pl_get_idx_of (playItem_t *it) { - return pl_get_idx_of_iter (it, PL_MAIN); +playItem_t * +pl_get_for_idx (int idx) { + return pl_get_for_idx_and_iter (idx, PL_MAIN); } int -pl_get_idx_of_iter (playItem_t *it, int iter) { +plt_get_item_idx (playlist_t *playlist, playItem_t *it, int iter) { LOCK; playItem_t *c = playlist->head[iter]; int idx = 0; @@ -1805,6 +1808,19 @@ pl_get_idx_of_iter (playItem_t *it, int iter) { return idx; } +int +pl_get_idx_of (playItem_t *it) { + return pl_get_idx_of_iter (it, PL_MAIN); +} + +int +pl_get_idx_of_iter (playItem_t *it, int iter) { + LOCK; + int idx = plt_get_item_idx (playlist, it, iter); + UNLOCK; + return idx; +} + playItem_t * plt_insert_item (playlist_t *playlist, playItem_t *after, playItem_t *it) { LOCK; @@ -3819,23 +3835,6 @@ pl_set_item_flags (playItem_t *it, uint32_t flags) { UNLOCK; } -int -plt_get_item_idx (playlist_t *plt, playItem_t *it, int iter) { - LOCK; - playItem_t *c = plt->head[iter]; - int idx = 0; - while (c && c != it) { - c = c->next[iter]; - idx++; - } - if (!c) { - UNLOCK; - return -1; - } - UNLOCK; - return idx; -} - playlist_t * pl_get_playlist (playItem_t *it) { LOCK; |