Commit f0366cc8 authored by Max Kellermann's avatar Max Kellermann

songvec: pass const pointers

Pass const songvec pointers to songvec_find() and songvec_for_each().
parent 8be60263
...@@ -23,7 +23,8 @@ void songvec_sort(struct songvec *sv) ...@@ -23,7 +23,8 @@ void songvec_sort(struct songvec *sv)
pthread_mutex_unlock(&nr_lock); pthread_mutex_unlock(&nr_lock);
} }
Song *songvec_find(struct songvec *sv, const char *url) Song *
songvec_find(const struct songvec *sv, const char *url)
{ {
int i; int i;
Song *ret = NULL; Song *ret = NULL;
...@@ -83,7 +84,9 @@ void songvec_destroy(struct songvec *sv) ...@@ -83,7 +84,9 @@ void songvec_destroy(struct songvec *sv)
pthread_mutex_unlock(&nr_lock); pthread_mutex_unlock(&nr_lock);
} }
int songvec_for_each(struct songvec *sv, int (*fn)(Song *, void *), void *arg) int
songvec_for_each(const struct songvec *sv,
int (*fn)(Song *, void *), void *arg)
{ {
size_t i; size_t i;
......
...@@ -11,7 +11,8 @@ struct songvec { ...@@ -11,7 +11,8 @@ struct songvec {
void songvec_sort(struct songvec *sv); void songvec_sort(struct songvec *sv);
Song *songvec_find(struct songvec *sv, const char *url); Song *
songvec_find(const struct songvec *sv, const char *url);
int songvec_delete(struct songvec *sv, const Song *del); int songvec_delete(struct songvec *sv, const Song *del);
...@@ -19,6 +20,8 @@ void songvec_add(struct songvec *sv, Song *add); ...@@ -19,6 +20,8 @@ void songvec_add(struct songvec *sv, Song *add);
void songvec_destroy(struct songvec *sv); void songvec_destroy(struct songvec *sv);
int songvec_for_each(struct songvec *sv, int (*fn)(Song *, void *), void *arg); int
songvec_for_each(const struct songvec *sv,
int (*fn)(Song *, void *), void *arg);
#endif /* SONGVEC_H */ #endif /* SONGVEC_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment