From 02a3980343aab1bf59b7842a5bce09890ce6769d Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Mon, 21 Dec 2020 11:56:18 +0100 Subject: [PATCH] Remove useless parameter from implementation --- fairmq/shmem/Common.h | 8 +++----- fairmq/shmem/Manager.h | 4 ++-- fairmq/shmem/Message.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fairmq/shmem/Common.h b/fairmq/shmem/Common.h index 8e9cdc11..95d38030 100644 --- a/fairmq/shmem/Common.h +++ b/fairmq/shmem/Common.h @@ -267,9 +267,8 @@ struct SegmentAllocateAligned : public boost::static_visitor struct SegmentBufferShrink : public boost::static_visitor { - SegmentBufferShrink(const size_t _old_size, const size_t _new_size, char* _local_ptr) - : old_size(_old_size) - , new_size(_new_size) + SegmentBufferShrink(const size_t _new_size, char* _local_ptr) + : new_size(_new_size) , local_ptr(_local_ptr) {} @@ -277,10 +276,9 @@ struct SegmentBufferShrink : public boost::static_visitor char* operator()(S& s) const { boost::interprocess::managed_shared_memory::size_type shrunk_size = new_size; - return s.template allocation_command(boost::interprocess::shrink_in_place, old_size + 128, shrunk_size, local_ptr); + return s.template allocation_command(boost::interprocess::shrink_in_place, new_size + 128, shrunk_size, local_ptr); } - const size_t old_size; const size_t new_size; mutable char* local_ptr; }; diff --git a/fairmq/shmem/Manager.h b/fairmq/shmem/Manager.h index 728e5e57..ba5473c2 100644 --- a/fairmq/shmem/Manager.h +++ b/fairmq/shmem/Manager.h @@ -565,9 +565,9 @@ class Manager #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; } diff --git a/fairmq/shmem/Message.h b/fairmq/shmem/Message.h index fcd5a388..f2b2fa55 100644 --- a/fairmq/shmem/Message.h +++ b/fairmq/shmem/Message.h @@ -196,7 +196,7 @@ class Message final : public fair::mq::Message return true; } else if (newSize <= fMeta.fSize) { try { - fLocalPtr = fManager.ShrinkInPlace(fMeta.fSize, newSize, fLocalPtr, fMeta.fSegmentId); + fLocalPtr = fManager.ShrinkInPlace(newSize, fLocalPtr, fMeta.fSegmentId); fMeta.fSize = newSize; return true; } catch (boost::interprocess::interprocess_exception& e) {