From 016d996131d560db6d72476ae29c74df84746fff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 28 Oct 2008 20:33:56 +0100 Subject: utils: use g_str_has_prefix() instead of prefixcmp() Remove duplicated code from MPD. --- src/playlist.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/playlist.c') 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, -- cgit v1.2.3