From: Julian Andres Klode Date: Thu, 7 Jan 2016 23:25:45 +0000 (+0100) Subject: pkgCacheGenerator::StoreString: Move the string into the map X-Git-Tag: 1.2_exp1~26 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/c5a858e39f83676fdf16f1bdae5966c96ee882ff?ds=sidebyside 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 --- 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; } /*}}}*/