db/simple/DirectorySave: pass std::string_view to _load_subdir()

Eliminates one strlen() call.
This commit is contained in:
Max Kellermann 2020-04-08 23:54:42 +02:00
parent 57fb153c5d
commit 3c240e2119

View File

@ -121,10 +121,11 @@ ParseLine(Directory &directory, const char *line)
} }
static Directory * 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) 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); Directory *directory = parent.CreateChild(name);