Skip to content

Commit

Permalink
Remove useless parameter from implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rbx committed Jan 13, 2021
1 parent 38b3478 commit 02a3980
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions fairmq/shmem/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,18 @@ struct SegmentAllocateAligned : public boost::static_visitor<void*>

struct SegmentBufferShrink : public boost::static_visitor<char*>
{
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)
{}

template<typename S>
char* operator()(S& s) const
{
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;
mutable char* local_ptr;
};
Expand Down
4 changes: 2 additions & 2 deletions fairmq/shmem/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion fairmq/shmem/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 02a3980

Please sign in to comment.