diff --git a/src/libutil/xml-writer.cc b/src/libutil/xml-writer.cc index 68857e34d..7993bee9a 100644 --- a/src/libutil/xml-writer.cc +++ b/src/libutil/xml-writer.cc @@ -31,11 +31,12 @@ void XMLWriter::close() void XMLWriter::indent_(size_t depth) { if (!indent) return; - output << string(depth * 2, ' '); + output << std::string(depth * 2, ' '); } -void XMLWriter::openElement(const string & name, +void XMLWriter::openElement( + std::string_view name, const XMLAttrs & attrs) { assert(!closed); @@ -44,7 +45,7 @@ void XMLWriter::openElement(const string & name, writeAttrs(attrs); output << ">"; if (indent) output << std::endl; - pendingElems.push_back(name); + pendingElems.push_back(std::string(name)); } @@ -59,7 +60,8 @@ void XMLWriter::closeElement() } -void XMLWriter::writeEmptyElement(const string & name, +void XMLWriter::writeEmptyElement( + std::string_view name, const XMLAttrs & attrs) { assert(!closed); diff --git a/src/libutil/xml-writer.hh b/src/libutil/xml-writer.hh index b98b44526..4c91adee6 100644 --- a/src/libutil/xml-writer.hh +++ b/src/libutil/xml-writer.hh @@ -8,12 +8,8 @@ namespace nix { -using std::string; -using std::map; -using std::list; - -typedef map XMLAttrs; +typedef std::map XMLAttrs; class XMLWriter @@ -25,7 +21,7 @@ private: bool indent; bool closed; - list pendingElems; + std::list pendingElems; public: @@ -34,11 +30,11 @@ public: void close(); - void openElement(const string & name, + void openElement(std::string_view name, const XMLAttrs & attrs = XMLAttrs()); void closeElement(); - void writeEmptyElement(const string & name, + void writeEmptyElement(std::string_view name, const XMLAttrs & attrs = XMLAttrs()); private: @@ -53,7 +49,7 @@ class XMLOpenElement private: XMLWriter & writer; public: - XMLOpenElement(XMLWriter & writer, const string & name, + XMLOpenElement(XMLWriter & writer, std::string_view name, const XMLAttrs & attrs = XMLAttrs()) : writer(writer) { diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 52d07e3df..f83edb6a1 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -833,7 +833,7 @@ static bool cmpElemByName(const DrvInfo & a, const DrvInfo & b) } -typedef list Table; +typedef std::list Table; void printTable(Table & table)