aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-28 20:33:56 +0100
committerMax Kellermann <max@duempel.org>2008-10-28 20:33:56 +0100
commit016d996131d560db6d72476ae29c74df84746fff (patch)
treec22a7d13e1b39927e70e73cbc8f78762fba0d92a /src/playlist.c
parent4a71f66256d02c46bc2bb3665cc6451a2101d5ac (diff)
downloadmpd-016d996131d560db6d72476ae29c74df84746fff.tar.gz
mpd-016d996131d560db6d72476ae29c74df84746fff.tar.xz
mpd-016d996131d560db6d72476ae29c74df84746fff.zip
utils: use g_str_has_prefix() instead of prefixcmp()
Remove duplicated code from MPD.
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 0baebc6ea..58db673aa 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -301,7 +301,7 @@ void readPlaylistState(FILE *fp)
char buffer[PLAYLIST_BUFFER_SIZE];
while (myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) {
- if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_STATE)) {
+ if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_STATE)) {
if (strcmp(&(buffer[strlen(PLAYLIST_STATE_FILE_STATE)]),
PLAYLIST_STATE_FILE_STATE_PLAY) == 0) {
state = PLAYER_STATE_PLAY;
@@ -312,24 +312,24 @@ void readPlaylistState(FILE *fp)
== 0) {
state = PLAYER_STATE_PAUSE;
}
- } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_TIME)) {
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_TIME)) {
seek_time =
atoi(&(buffer[strlen(PLAYLIST_STATE_FILE_TIME)]));
} else
- if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_REPEAT)) {
+ if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_REPEAT)) {
if (strcmp
(&(buffer[strlen(PLAYLIST_STATE_FILE_REPEAT)]),
"1") == 0) {
setPlaylistRepeatStatus(true);
} else
setPlaylistRepeatStatus(false);
- } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_CROSSFADE)) {
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_CROSSFADE)) {
setPlayerCrossFade(atoi
(&
(buffer
[strlen
(PLAYLIST_STATE_FILE_CROSSFADE)])));
- } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_RANDOM)) {
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_RANDOM)) {
if (strcmp
(&
(buffer
@@ -338,15 +338,15 @@ void readPlaylistState(FILE *fp)
setPlaylistRandomStatus(true);
} else
setPlaylistRandomStatus(false);
- } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_CURRENT)) {
+ } else if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_CURRENT)) {
if (strlen(buffer) ==
strlen(PLAYLIST_STATE_FILE_CURRENT))
state_file_fatal();
current = atoi(&(buffer
[strlen
(PLAYLIST_STATE_FILE_CURRENT)]));
- } else if (!prefixcmp(buffer,
- PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) {
+ } else if (g_str_has_prefix(buffer,
+ PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) {
if (state == PLAYER_STATE_STOP)
current = -1;
loadPlaylistFromStateFile(fp, buffer, state,