diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-23 20:48:12 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-23 20:48:12 +0200 |
commit | 27fad52c6bb1d8803f400a6e95fa5c24396a1c12 (patch) | |
tree | 9b1fadeef43c3193b29344cda223c7b2c754433b /src/playlist.c | |
parent | f5df13f853cf4c0e529244dd40ab57c78a7d1bc6 (diff) | |
download | mpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.tar.gz mpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.tar.xz mpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.zip |
start using prefixcmp()
LOC reduction and less noise makes things easier for
tired old folks to follow.
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/playlist.c b/src/playlist.c index e053eb1e1..296b2689b 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -309,8 +309,7 @@ void readPlaylistState(FILE *fp) char buffer[PLAYLIST_BUFFER_SIZE]; while (myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) { - if (strncmp(buffer, PLAYLIST_STATE_FILE_STATE, - strlen(PLAYLIST_STATE_FILE_STATE)) == 0) { + if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_STATE)) { if (strcmp(&(buffer[strlen(PLAYLIST_STATE_FILE_STATE)]), PLAYLIST_STATE_FILE_STATE_PLAY) == 0) { state = PLAYER_STATE_PLAY; @@ -321,33 +320,24 @@ void readPlaylistState(FILE *fp) == 0) { state = PLAYER_STATE_PAUSE; } - } else if (strncmp(buffer, PLAYLIST_STATE_FILE_TIME, - strlen(PLAYLIST_STATE_FILE_TIME)) == 0) { + } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_TIME)) { seek_time = atoi(&(buffer[strlen(PLAYLIST_STATE_FILE_TIME)])); } else - if (strncmp - (buffer, PLAYLIST_STATE_FILE_REPEAT, - strlen(PLAYLIST_STATE_FILE_REPEAT)) == 0) { + if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_REPEAT)) { if (strcmp (&(buffer[strlen(PLAYLIST_STATE_FILE_REPEAT)]), "1") == 0) { setPlaylistRepeatStatus(1); } else setPlaylistRepeatStatus(0); - } else - if (strncmp - (buffer, PLAYLIST_STATE_FILE_CROSSFADE, - strlen(PLAYLIST_STATE_FILE_CROSSFADE)) == 0) { + } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_CROSSFADE)) { setPlayerCrossFade(atoi (& (buffer [strlen (PLAYLIST_STATE_FILE_CROSSFADE)]))); - } else - if (strncmp - (buffer, PLAYLIST_STATE_FILE_RANDOM, - strlen(PLAYLIST_STATE_FILE_RANDOM)) == 0) { + } else if (!prefixcmp(buffer, PLAYLIST_STATE_FILE_RANDOM)) { if (strcmp (& (buffer @@ -356,20 +346,15 @@ void readPlaylistState(FILE *fp) setPlaylistRandomStatus(1); } else setPlaylistRandomStatus(0); - } else if (strncmp(buffer, PLAYLIST_STATE_FILE_CURRENT, - strlen(PLAYLIST_STATE_FILE_CURRENT)) - == 0) { + } else if (!prefixcmp(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 (strncmp - (buffer, PLAYLIST_STATE_FILE_PLAYLIST_BEGIN, - strlen(PLAYLIST_STATE_FILE_PLAYLIST_BEGIN) - ) == 0) { + } else if (!prefixcmp(buffer, + PLAYLIST_STATE_FILE_PLAYLIST_BEGIN)) { if (state == PLAYER_STATE_STOP) current = -1; loadPlaylistFromStateFile(fp, buffer, state, |