aboutsummaryrefslogtreecommitdiffstats
path: root/src/songvec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/songvec.c')
-rw-r--r--src/songvec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/songvec.c b/src/songvec.c
index 969e67220..50694c68a 100644
--- a/src/songvec.c
+++ b/src/songvec.c
@@ -68,6 +68,19 @@ void songvec_destroy(struct songvec *sv)
sv->nr = 0;
}
+int songvec_for_each(struct songvec *sv, int (*fn)(Song *, void *), void *arg)
+{
+ int i;
+ Song **sp = sv->base;
+
+ for (i = sv->nr; --i >= 0; ) {
+ if (fn(*sp++, arg) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
int songvec_write(struct songvec *sv, int fd, int extra)
{
int i;