Parcourir la source

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
Julian Andres Klode il y a 10 ans
Parent
commit
c5a858e39f
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      apt-pkg/pkgcachegen.cc

+ 2 - 2
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<std::string,map_stringitem_t> * 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;
 }
 									/*}}}*/