Skip to content

Commit 2db889c

Browse files
authored
Merge branch 'main' into feat/dtrace
2 parents fea4f69 + 7ab4c13 commit 2db889c

24 files changed

+1379
-1027
lines changed

src/groups/bmq/bmqp/bmqp_event.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,19 +412,28 @@ inline Event::Event(bslmf::MovableRef<Event> src, bslma::Allocator* allocator)
412412

413413
inline Event& Event::operator=(const Event& rhs)
414414
{
415-
if (this != &rhs) {
416-
d_clonedBlob_sp = rhs.d_clonedBlob_sp; // src could be a clone
417-
initialize(rhs.d_blob_p, false);
415+
if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(this == &rhs)) {
416+
// Return early on self-assignment.
417+
BSLS_PERFORMANCEHINT_UNLIKELY_HINT;
418+
return *this;
418419
}
420+
421+
d_clonedBlob_sp = rhs.d_clonedBlob_sp; // src could be a clone
422+
initialize(rhs.d_blob_p, false);
419423
return *this;
420424
}
421425

422426
inline Event& Event::operator=(bslmf::MovableRef<Event> rhs)
423427
{
424-
if (this != &bslmf::MovableRefUtil::access(rhs)) {
425-
d_clonedBlob_sp = bslmf::MovableRefUtil::access(rhs).d_clonedBlob_sp;
426-
initialize(bslmf::MovableRefUtil::access(rhs).d_blob_p, false);
428+
if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(
429+
this == &bslmf::MovableRefUtil::access(rhs))) {
430+
// Return early on self-assignment.
431+
BSLS_PERFORMANCEHINT_UNLIKELY_HINT;
432+
return *this;
427433
}
434+
435+
d_clonedBlob_sp = bslmf::MovableRefUtil::access(rhs).d_clonedBlob_sp;
436+
initialize(bslmf::MovableRefUtil::access(rhs).d_blob_p, false);
428437
return *this;
429438
}
430439

0 commit comments

Comments
 (0)