From 738583e3d4cd7a35aec545448f86a8c097768785 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Nov 2015 15:34:36 +0100 Subject: StateFile: use StringAfterPrefix() instead of StringStartsWith() --- src/queue/QueueSave.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/queue/QueueSave.cxx') diff --git a/src/queue/QueueSave.cxx b/src/queue/QueueSave.cxx index cb8611cf8..3b9589450 100644 --- a/src/queue/QueueSave.cxx +++ b/src/queue/QueueSave.cxx @@ -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); -- cgit v1.2.3