From 9d872e56f0ca9b724d88f99bda26c431fbb0ddc2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Jul 2009 21:38:33 +0200 Subject: [PATCH] file: moved strcmp() call to inline function same_song() --- src/filelist.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/filelist.c b/src/filelist.c index 92e6379..100db88 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -20,6 +20,7 @@ #include "filelist.h" #include "libmpdclient.h" +#include #include #include @@ -167,6 +168,12 @@ filelist_sort_dir_play(struct filelist *filelist, GCompareFunc compare_func) filelist_compare_indirect, compare_func); } +static bool +same_song(const struct mpd_song *a, const struct mpd_song *b) +{ + return strcmp(a->file, b->file) == 0; +} + int filelist_find_song(struct filelist *fl, const struct mpd_song *song) { @@ -181,7 +188,7 @@ filelist_find_song(struct filelist *fl, const struct mpd_song *song) if (entity && entity->type == MPD_INFO_ENTITY_TYPE_SONG) { struct mpd_song *song2 = entity->info.song; - if (strcmp(song->file, song2->file) == 0) + if (same_song(song, song2)) return i; } } -- 2.30.2