mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-02 08:55:53 +00:00
Eliminate code duplication and improve documentation:
The legacy functions `cdirFirst` and `dirFirst` were mostly identical; the differences were only type-related. The same situation existed with `cdirNext` and `dirNext`. This commit removes the duplicated code by introducing new template functions that abstract away the differences that are present between each pair of functions. This commit also improves the naming of function arguments, helping to elucidate their purpose & use and to make the code self-documenting.
This commit is contained in:
@@ -3410,13 +3410,7 @@ NetworkOPsImp::getBookPage(
|
||||
uTipIndex = sleOfferDir->key();
|
||||
saDirRate = amountFromQuality(getQuality(uTipIndex));
|
||||
|
||||
cdirFirst(
|
||||
view,
|
||||
uTipIndex,
|
||||
sleOfferDir,
|
||||
uBookEntry,
|
||||
offerIndex,
|
||||
viewJ);
|
||||
cdirFirst(view, uTipIndex, sleOfferDir, uBookEntry, offerIndex);
|
||||
|
||||
JLOG(m_journal.trace())
|
||||
<< "getBookPage: uTipIndex=" << uTipIndex;
|
||||
@@ -3536,13 +3530,7 @@ NetworkOPsImp::getBookPage(
|
||||
JLOG(m_journal.warn()) << "Missing offer";
|
||||
}
|
||||
|
||||
if (!cdirNext(
|
||||
view,
|
||||
uTipIndex,
|
||||
sleOfferDir,
|
||||
uBookEntry,
|
||||
offerIndex,
|
||||
viewJ))
|
||||
if (!cdirNext(view, uTipIndex, sleOfferDir, uBookEntry, offerIndex))
|
||||
{
|
||||
bDirectAdvance = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user