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/directory.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/directory.c')
-rw-r--r-- | src/directory.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/directory.c b/src/directory.c index 6762e92bf..0fec43387 100644 --- a/src/directory.c +++ b/src/directory.c @@ -889,22 +889,18 @@ static void readDirectoryInfo(FILE * fp, Directory * directory) ListNode *nodeTemp; while (myFgets(buffer, bufferSize, fp) - && 0 != strncmp(DIRECTORY_END, buffer, strlen(DIRECTORY_END))) { - if (0 == strncmp(DIRECTORY_DIR, buffer, strlen(DIRECTORY_DIR))) { + && prefixcmp(buffer, DIRECTORY_END)) { + if (!prefixcmp(buffer, DIRECTORY_DIR)) { strcpy(key, &(buffer[strlen(DIRECTORY_DIR)])); if (!myFgets(buffer, bufferSize, fp)) FATAL("Error reading db, fgets\n"); /* for compatibility with db's prior to 0.11 */ - if (0 == strncmp(DIRECTORY_MTIME, buffer, - strlen(DIRECTORY_MTIME))) { + if (!prefixcmp(buffer, DIRECTORY_MTIME)) { if (!myFgets(buffer, bufferSize, fp)) FATAL("Error reading db, fgets\n"); } - if (strncmp - (DIRECTORY_BEGIN, buffer, - strlen(DIRECTORY_BEGIN))) { + if (prefixcmp(buffer, DIRECTORY_BEGIN)) FATAL("Error reading db at line: %s\n", buffer); - } name = &(buffer[strlen(DIRECTORY_BEGIN)]); while (nextDirNode && (strcmpRet = @@ -932,7 +928,7 @@ static void readDirectoryInfo(FILE * fp, Directory * directory) } readDirectoryInfo(fp, subDirectory); - } else if (0 == strncmp(SONG_BEGIN, buffer, strlen(SONG_BEGIN))) { + } else if (!prefixcmp(buffer, SONG_BEGIN)) { readSongInfoIntoList(fp, directory->songs, directory); } else { FATAL("Unknown line in db: %s\n", buffer); @@ -1086,16 +1082,13 @@ int readDirectoryDB(void) if (0 == strcmp(DIRECTORY_INFO_BEGIN, buffer)) { while (myFgets(buffer, bufferSize, fp) && 0 != strcmp(DIRECTORY_INFO_END, buffer)) { - if (0 == strncmp(DIRECTORY_MPD_VERSION, buffer, - strlen(DIRECTORY_MPD_VERSION))) + if (!prefixcmp(buffer, DIRECTORY_MPD_VERSION)) { if (foundVersion) FATAL("already found version in db\n"); foundVersion = 1; - } else if (0 == - strncmp(DIRECTORY_FS_CHARSET, buffer, - strlen - (DIRECTORY_FS_CHARSET))) { + } else if (!prefixcmp(buffer, + DIRECTORY_FS_CHARSET)) { char *fsCharset; char *tempCharset; |