From c5a858e39f83676fdf16f1bdae5966c96ee882ff Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 8 Jan 2016 00:25:45 +0100 Subject: pkgCacheGenerator::StoreString: Move the string into the map Moving the string is likely faster than copying it. We could probably avoid strings alltogether in the future using some more crazy code, but I have not looked at that yet. Gbp-Dch: ignore --- apt-pkg/pkgcachegen.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/pkgcachegen.cc') diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index abc326558..db8131651 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1257,7 +1257,7 @@ bool pkgCacheGenerator::SelectFile(std::string const &File, map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, const char *S, unsigned int Size) { - std::string const key(S, Size); + std::string key(S, Size); std::unordered_map * strings; switch(type) { @@ -1273,7 +1273,7 @@ map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, cons return item->second; map_stringitem_t const idxString = WriteStringInMap(S,Size); - strings->insert(std::make_pair(key, idxString)); + strings->insert(std::make_pair(std::move(key), idxString)); return idxString; } /*}}}*/ -- cgit v1.2.3