Skip to content

Commit 0013fde

Browse files
committed
[FOLD] Address @seelabs feedback
* Change STObject::set() arg to rvalue ref
1 parent 4e6f210 commit 0013fde

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/ripple/app/misc/impl/AMMUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ initializeFeeAuctionVote(
314314
{
315315
STObject auctionSlot =
316316
STObject::makeInnerObject(sfAuctionSlot, rules);
317-
ammSle->set(&auctionSlot);
317+
ammSle->set(std::move(auctionSlot));
318318
}
319319
return ammSle->peekFieldObject(sfAuctionSlot);
320320
}

src/ripple/protocol/STObject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ class STObject : public STBase, public CountedObject<STObject>
343343
set(std::unique_ptr<STBase> v);
344344

345345
void
346-
set(STBase* v);
346+
set(STBase&& v);
347347

348348
void
349349
setFieldU8(SField const& field, unsigned char);

src/ripple/protocol/impl/STObject.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -645,23 +645,22 @@ STObject::getFieldArray(SField const& field) const
645645
void
646646
STObject::set(std::unique_ptr<STBase> v)
647647
{
648-
set(v.get());
648+
set(std::move(*v.get()));
649649
}
650650

651651
void
652-
STObject::set(STBase* v)
652+
STObject::set(STBase&& v)
653653
{
654-
assert(v);
655-
auto const i = getFieldIndex(v->getFName());
654+
auto const i = getFieldIndex(v.getFName());
656655
if (i != -1)
657656
{
658-
v_[i] = std::move(*v);
657+
v_[i] = std::move(v);
659658
}
660659
else
661660
{
662661
if (!isFree())
663662
Throw<std::runtime_error>("missing field in templated STObject");
664-
v_.emplace_back(std::move(*v));
663+
v_.emplace_back(std::move(v));
665664
}
666665
}
667666

0 commit comments

Comments
 (0)