Skip to content

Commit 98e1fb8

Browse files
committed
change hook slot emplacement to use [] operator to fix XRPLF#112
1 parent 40631c1 commit 98e1fb8

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/ripple/app/hook/impl/applyHook.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -2041,10 +2041,11 @@ DEFINE_HOOK_FUNCTION(
20412041
: const_cast<ripple::STTx&>(applyCtx.tx).downcast<ripple::STObject>()
20422042
);
20432043

2044-
hookCtx.slot.emplace( std::pair<uint32_t, hook::SlotEntry> { slot_into, hook::SlotEntry {
2045-
.storage = st_tx,
2046-
.entry = 0
2047-
}});
2044+
hookCtx.slot[slot_into] = hook::SlotEntry {
2045+
.storage = st_tx,
2046+
.entry = 0
2047+
};
2048+
20482049
hookCtx.slot[slot_into].entry = &(*hookCtx.slot[slot_into].storage);
20492050

20502051
return slot_into;
@@ -5531,10 +5532,11 @@ DEFINE_HOOK_FUNCTION(
55315532
return NO_FREE_SLOTS;
55325533
}
55335534

5534-
hookCtx.slot.emplace( std::pair<uint32_t, hook::SlotEntry> { slot_into, hook::SlotEntry {
5535-
.storage = hookCtx.result.provisionalMeta,
5536-
.entry = 0
5537-
}});
5535+
hookCtx.slot[slot_into] = hook::SlotEntry {
5536+
.storage = hookCtx.result.provisionalMeta,
5537+
.entry = 0
5538+
};
5539+
55385540
hookCtx.slot[slot_into].entry = &(*hookCtx.slot[slot_into].storage);
55395541

55405542
return slot_into;
@@ -5590,17 +5592,17 @@ DEFINE_HOOK_FUNCTION(
55905592
if (!tx || !meta)
55915593
return INVALID_TXN;
55925594

5593-
hookCtx.slot.emplace( std::pair<uint32_t, hook::SlotEntry> { slot_into_tx, hook::SlotEntry {
5595+
hookCtx.slot[slot_into_tx] = hook::SlotEntry {
55945596
.storage = std::move(tx),
55955597
.entry = 0
5596-
}});
5598+
};
55975599

55985600
hookCtx.slot[slot_into_tx].entry = &(*hookCtx.slot[slot_into_tx].storage);
55995601

5600-
hookCtx.slot.emplace( std::pair<uint32_t, hook::SlotEntry> { slot_into_meta, hook::SlotEntry {
5602+
hookCtx.slot[slot_into_meta] = hook::SlotEntry {
56015603
.storage = std::move(meta),
56025604
.entry = 0
5603-
}});
5605+
};
56045606

56055607
hookCtx.slot[slot_into_meta].entry = &(*hookCtx.slot[slot_into_meta].storage);
56065608

0 commit comments

Comments
 (0)