Commit Diff
Commit:
532ca63cfb62d6e60321aff668a4330fdd0a7fb5
From:
Omar Polo <op@omarpolo.com>
Date:
Thu Feb 17 10:27:56 2022 UTC
Message:
add playlist_push
commit - c8777fe45597b82a1f898eca06dfc67675de9927
commit + 532ca63cfb62d6e60321aff668a4330fdd0a7fb5
blob - 23f7cd2e63ec0aa98e5b364d97433bd52ad1c8cf
blob + bbbe6b703ba393af1b822c6284a07f989c6a250f
--- playlist.c
+++ playlist.c
@@ -30,20 +30,26 @@ playlist_enqueue(const char *path)
ssize_t play_off = -1;
void
-playlist_enqueue(const char *path)
+playlist_push(struct playlist *playlist, const char *path)
{
size_t newcap;
- if (playlist.len == playlist.cap) {
- newcap = MAX(16, playlist.cap * 1.5);
- playlist.songs = xrecallocarray(playlist.songs, playlist.cap,
- newcap, sizeof(*playlist.songs));
- playlist.cap = newcap;
+ if (playlist->len == playlist->cap) {
+ newcap = MAX(16, playlist->cap * 1.5);
+ playlist->songs = xrecallocarray(playlist->songs,
+ playlist->cap, newcap, sizeof(*playlist->songs));
+ playlist->cap = newcap;
}
- playlist.songs[playlist.len++] = xstrdup(path);
+ playlist->songs[playlist->len++] = xstrdup(path);
}
+void
+playlist_enqueue(const char *path)
+{
+ playlist_push(&playlist, path);
+}
+
const char *
playlist_current(void)
{
blob - 7f4fc4260740ed4701141bd6cd05c23d778f2f66
blob + 8adc896b043149dd519d45be13646d7288c0ebe4
--- playlist.h
+++ playlist.h
@@ -36,6 +36,7 @@ void playlist_enqueue(const char *);
extern int repeat_all;
extern ssize_t play_off;
+void playlist_push(struct playlist *, const char *);
void playlist_enqueue(const char *);
const char *playlist_current(void);
const char *playlist_advance(void);
Omar Polo