Remove useless parameter from implementation

This commit is contained in:
Alexey Rybalchenko 2020-12-21 11:56:18 +01:00
parent 38b34785e0
commit 02a3980343
3 changed files with 6 additions and 8 deletions

View File

@ -267,9 +267,8 @@ struct SegmentAllocateAligned : public boost::static_visitor<void*>
struct SegmentBufferShrink : public boost::static_visitor<char*> struct SegmentBufferShrink : public boost::static_visitor<char*>
{ {
SegmentBufferShrink(const size_t _old_size, const size_t _new_size, char* _local_ptr) SegmentBufferShrink(const size_t _new_size, char* _local_ptr)
: old_size(_old_size) : new_size(_new_size)
, new_size(_new_size)
, local_ptr(_local_ptr) , local_ptr(_local_ptr)
{} {}
@ -277,10 +276,9 @@ struct SegmentBufferShrink : public boost::static_visitor<char*>
char* operator()(S& s) const char* operator()(S& s) const
{ {
boost::interprocess::managed_shared_memory::size_type shrunk_size = new_size; boost::interprocess::managed_shared_memory::size_type shrunk_size = new_size;
return s.template allocation_command<char>(boost::interprocess::shrink_in_place, old_size + 128, shrunk_size, local_ptr); return s.template allocation_command<char>(boost::interprocess::shrink_in_place, new_size + 128, shrunk_size, local_ptr);
} }
const size_t old_size;
const size_t new_size; const size_t new_size;
mutable char* local_ptr; mutable char* local_ptr;
}; };

View File

@ -565,9 +565,9 @@ class Manager
#endif #endif
} }
char* ShrinkInPlace(size_t oldSize, size_t newSize, char* localPtr, uint16_t segmentId) char* ShrinkInPlace(size_t newSize, char* localPtr, uint16_t segmentId)
{ {
return boost::apply_visitor(SegmentBufferShrink{oldSize, newSize, localPtr}, fSegments.at(segmentId)); return boost::apply_visitor(SegmentBufferShrink{newSize, localPtr}, fSegments.at(segmentId));
} }
uint16_t GetSegmentId() const { return fSegmentId; } uint16_t GetSegmentId() const { return fSegmentId; }

View File

@ -196,7 +196,7 @@ class Message final : public fair::mq::Message
return true; return true;
} else if (newSize <= fMeta.fSize) { } else if (newSize <= fMeta.fSize) {
try { try {
fLocalPtr = fManager.ShrinkInPlace(fMeta.fSize, newSize, fLocalPtr, fMeta.fSegmentId); fLocalPtr = fManager.ShrinkInPlace(newSize, fLocalPtr, fMeta.fSegmentId);
fMeta.fSize = newSize; fMeta.fSize = newSize;
return true; return true;
} catch (boost::interprocess::interprocess_exception& e) { } catch (boost::interprocess::interprocess_exception& e) {