Explorar o código

Use cached filesize instead of calling size() again

Tatsuhiro Tsujikawa %!s(int64=10) %!d(string=hai) anos
pai
achega
dfadc2e68b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/AbstractDiskWriter.cc

+ 1 - 1
src/AbstractDiskWriter.cc

@@ -380,7 +380,7 @@ void AbstractDiskWriter::ensureMmapWrite(size_t len, int64_t offset)
         }
 #else // !__MINGW32__
         mapaddr_ = reinterpret_cast<unsigned char*>
-          (mmap(nullptr, size(), PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0));
+          (mmap(nullptr, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0));
         if(!mapaddr_) {
           errNum = errno;
         }