From 22196e8e8ffb782f32a7689d9cc8962f82214248 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Jul 2009 19:20:25 +0200 Subject: [PATCH] playlist: pass const pointers when possible --- src/playlist.c | 8 ++++---- src/playlist.h | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/playlist.c b/src/playlist.c index 5f3dd45..0a44833 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -85,7 +85,7 @@ playlist_lookup_song(mpdclient_t *c, gint id) } gint -playlist_get_index(mpdclient_t *c, struct mpd_song *song) +playlist_get_index(const struct mpdclient *c, const struct mpd_song *song) { guint i; @@ -98,12 +98,12 @@ playlist_get_index(mpdclient_t *c, struct mpd_song *song) } gint -playlist_get_index_from_id(mpdclient_t *c, gint id) +playlist_get_index_from_id(const struct mpdclient *c, gint id) { guint i; for (i = 0; i < c->playlist.list->len; ++i) { - struct mpd_song *song = playlist_get(&c->playlist, i); + const struct mpd_song *song = playlist_get(&c->playlist, i); if (song->id == id) return (gint)i; } @@ -112,7 +112,7 @@ playlist_get_index_from_id(mpdclient_t *c, gint id) } gint -playlist_get_index_from_file(mpdclient_t *c, gchar *filename) +playlist_get_index_from_file(const struct mpdclient *c, const gchar *filename) { guint i; diff --git a/src/playlist.h b/src/playlist.h index 454f1f0..77983f6 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -124,10 +124,13 @@ struct mpd_song *playlist_lookup_song(struct mpdclient *c, gint id); struct mpd_song *playlist_get_song(struct mpdclient *c, gint index); -gint playlist_get_index(struct mpdclient *c, struct mpd_song *song); +gint +playlist_get_index(const struct mpdclient *c, const struct mpd_song *song); -gint playlist_get_index_from_id(struct mpdclient *c, gint id); +gint +playlist_get_index_from_id(const struct mpdclient *c, gint id); -gint playlist_get_index_from_file(struct mpdclient *c, gchar *filename); +gint +playlist_get_index_from_file(const struct mpdclient *c, const gchar *filename); #endif -- 2.30.2