StateFile: use StringAfterPrefix() instead of StringStartsWith()

This commit is contained in:
Max Kellermann
2015-11-11 15:34:36 +01:00
parent c513478c31
commit 738583e3d4
4 changed files with 30 additions and 41 deletions

View File

@@ -83,8 +83,9 @@ queue_load_song(TextFile &file, const SongLoader &loader,
return;
uint8_t priority = 0;
if (StringStartsWith(line, PRIO_LABEL)) {
priority = strtoul(line + sizeof(PRIO_LABEL) - 1, nullptr, 10);
const char *p;
if ((p = StringAfterPrefix(line, PRIO_LABEL))) {
priority = strtoul(p, nullptr, 10);
line = file.ReadLine();
if (line == nullptr)
@@ -93,8 +94,8 @@ queue_load_song(TextFile &file, const SongLoader &loader,
DetachedSong *song;
if (StringStartsWith(line, SONG_BEGIN)) {
const char *uri = line + sizeof(SONG_BEGIN) - 1;
if ((p = StringAfterPrefix(line, PRIO_LABEL))) {
const char *uri = p;
Error error;
song = song_load(file, uri, error);