From 3c240e21197fb0e152e978f223df060e220ef989 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Apr 2020 23:54:42 +0200 Subject: [PATCH] db/simple/DirectorySave: pass std::string_view to _load_subdir() Eliminates one strlen() call. --- src/db/plugins/simple/DirectorySave.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db/plugins/simple/DirectorySave.cxx b/src/db/plugins/simple/DirectorySave.cxx index 5db129992..1eed26d01 100644 --- a/src/db/plugins/simple/DirectorySave.cxx +++ b/src/db/plugins/simple/DirectorySave.cxx @@ -121,10 +121,11 @@ ParseLine(Directory &directory, const char *line) } static Directory * -directory_load_subdir(TextFile &file, Directory &parent, const char *name) +directory_load_subdir(TextFile &file, Directory &parent, std::string_view name) { if (parent.FindChild(name) != nullptr) - throw FormatRuntimeError("Duplicate subdirectory '%s'", name); + throw FormatRuntimeError("Duplicate subdirectory '%.*s'", + int(name.size()), name.data()); Directory *directory = parent.CreateChild(name);