aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-20 16:07:54 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-20 16:07:54 -0700
commit95817fee8a01f1cdef2f0fb66d351dd031b91c7e (patch)
tree49bb0928d88ea814784d94b3bf8b653ea9b5a5d4 /src/song.c
parent5a42e7362b3745fb59f0aa49bab624f7fba83eff (diff)
downloadmpd-95817fee8a01f1cdef2f0fb66d351dd031b91c7e.tar.gz
mpd-95817fee8a01f1cdef2f0fb66d351dd031b91c7e.tar.xz
mpd-95817fee8a01f1cdef2f0fb66d351dd031b91c7e.zip
start using prefixcmp()
LOC reduction and less noise makes things easier for tired old folks to follow.
Diffstat (limited to '')
-rw-r--r--src/song.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/song.c b/src/song.c
index ab900a6b4..ff0ada620 100644
--- a/src/song.c
+++ b/src/song.c
@@ -218,8 +218,7 @@ static int matchesAnMpdTagItemKey(char *buffer, int *itemType)
int i;
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
- if (0 == strncmp(mpdTagItemKeys[i], buffer,
- strlen(mpdTagItemKeys[i]))) {
+ if (!prefixcmp(buffer, mpdTagItemKeys[i])) {
*itemType = i;
return 1;
}
@@ -238,7 +237,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
int itemType;
while (myFgets(buffer, bufferSize, fp) && 0 != strcmp(SONG_END, buffer)) {
- if (0 == strncmp(SONG_KEY, buffer, strlen(SONG_KEY))) {
+ if (!prefixcmp(buffer, SONG_KEY)) {
if (song) {
insertSongIntoList(list, &nextSongNode,
song->url, song);
@@ -254,7 +253,7 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
/* ignore empty lines (starting with '\0') */
} else if (song == NULL) {
FATAL("Problems reading song info\n");
- } else if (0 == strncmp(SONG_FILE, buffer, strlen(SONG_FILE))) {
+ } else if (!prefixcmp(buffer, SONG_FILE)) {
/* we don't need this info anymore
song->url = xstrdup(&(buffer[strlen(SONG_FILE)]));
*/
@@ -268,14 +267,14 @@ void readSongInfoIntoList(FILE * fp, SongList * list, Directory * parentDir)
&(buffer
[strlen(mpdTagItemKeys[itemType]) +
2]));
- } else if (0 == strncmp(SONG_TIME, buffer, strlen(SONG_TIME))) {
+ } else if (!prefixcmp(buffer, SONG_TIME)) {
if (!song->tag) {
song->tag = tag_new();
tag_begin_add(song->tag);
}
song->tag->time = atoi(&(buffer[strlen(SONG_TIME)]));
- } else if (0 == strncmp(SONG_MTIME, buffer, strlen(SONG_MTIME))) {
+ } else if (!prefixcmp(buffer, SONG_MTIME)) {
song->mtime = atoi(&(buffer[strlen(SONG_MTIME)]));
}
else